Allied Telesis Support Portal

How to trigger a script in AW+

The Trigger facility provides a powerful mechanism for automatic and timed management of your device by automating the execution of commands in response to certain events.
Scripting is an integral part of AW+ such as scripts can be created on any AW+ switch.
In practice, a script is a sequence of commands stored as a plain text file on the device Flash memory.

A trigger is an ordered list of scripts that will be executed when a certain event will occur.
Examples of events that can fire a trigger are: changing link status (up or down) of a specific interface, CPU utilization going over a predefined threshold level, Stack availability change or even a specific time of the day.
Each script can be defined in the launch list of one or more triggers.
When an event activates a trigger, the trigger executes the associated list of scripts in the exact order of definition. Each script in the list will be launched only after the previous one in the list has ended.

Example

In this example a trigger is enabled when a specific IP address becomes unreachable, the trigger launches a script that enables another IP address.
First of all let's create a script with the AW+ editor

Edit ip-up.scp

    ena
    conf t
    int vlan100
    ip addr 2.2.2.10/24 sec
    exit
    exit


    Ctrl+K+X to exit


Then we need to create a Ping Poll instance to monitor the reachability of the remote interface.

ping-poll 1
 ip 1.1.1.1
 up-count 2
 fail-count 2
 active


Finally let's define the Trigger:

trigger 1
 type ping-poll 1 down
 script 1 ip-up.scp


Disclaimer
The scripts presented here are provided solely as examples. Allied Telesis gives no warranty that such scripts are accurate, up-to-date, effective, complete or suitable for your purposes. You acknowledge that use of these scripts and documentation is entirely at your own risk and remains solely your responsibility. In no event will Allied Telesis be liable for any damages whatsoever, arising out of the use of or inability to use the sample scripts or documentation.

Previous MonthNext Month
SunMonTueWedThuFriSat