View Only

Scripting How-To: poesched helps save energy and costs

By Erdem posted 08-14-2015 14:55



Disable PoE ports during non-business hours to save energy and cut costs. This applies to SLAX version 1.0 and higher.


Save power and reduce costs by automatically disabling some of the network power consumption during non-business hours. Automatically turn power on and off to PoE ports on a specific schedule for defined locations.

Once activated, this script will be triggered once every hour, comparing the on and off configurations with the actual times of the configured locations. The PoE ports will be disabled and enabled according to the configured schedules.

Set Up

  1. Copy the file poesched.slax to the /var/db/scripts/event directory on the router.
  2. Use a text editor to create the configuration below. On the lines marked EDIT HERE, customize each of the off and on timeframes to match the location needs. The hours are recorded in 24-hour notation. Also change all interface names to match valid names.
    01 poe {
    02     apply-macro scheduler-admin {
    03         off 8; /* EDIT HERE */
    04         on 4; /* EDIT HERE */
    05     }
    06      apply-macro scheduler-finance {
    07         off 1; /* EDIT HERE */
    08         on 9; /* EDIT HERE */
    09     }
    10     interface ge-0/0/0 { /* EDIT HERE */
    11         apply-macro scheduler {
    12             group admin;
    13         }
    14 }
    15     interface ge-0/0/1 { /* EDIT HERE */
    16         apply-macro scheduler {
    17             group admin;
    18         }
    19     }
    20 }
  3. Save this configuration and copy it to the clipboard.
  4. Enable the script by adding the file statement and script filename to the [edit event-options event-script] hierarchy level in the configuration. Only superusers can enable scripts in the configuration.
    1 [edit event-options event-script]
    2 user@host# set file poesched.slax
  5. On the device, enter configuration mode:
    1 user@host% cli
    2 user@host> configure
    3 Entering configuration mode
    4 [edit]
    5 user@host#
  6. Use the load merge terminal command to load the configuration information and merge it with the current configuration:
    1 [edit]
    2 user@host# load merge terminal
    3 [Type ^D at a new line to end input]