Allied Telesis Support Portal

How to trigger a script in AlliedWare Plus

How to trigger a script within AW+

Introduction

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:

This example shows to to automate a daily backup of the configuration. You can easily do it. TFTP, HTTP or SCP should be OK, but SCP will require public key authentication because the password can't be scripted.

First, Write the bash.sh:

edit conf-backup.sh

date=$(date '+%Y-%m-%d-%H:%M:%S')
host=$(hostname)
file=$host-conf-$date.cfg
echo -e "show run" | imish > $file
tftp -l $file -r /michaelmo/val2009/$file -p 172.30.1.144

Then create a daily trigger on the switch:
trigger 1
 type time 12:03
 script 1 conf-backup.sh

Done!

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.