Reboot Router
For example, if the CPU utilization on a router stays consistently at 80%, the following plugin can be used to reboot a router. The files must be placed in the $TRAVERSE_HOME/plugins/actions
directory.
plugin/actions/rebootRouter.xml
<?xml version="1.0" standalone="yes"?>
<ActionScriptConfig>
<name>Reboot Router (via telnet)</name>
<rootScript>rebootRouter.pl</rootScript>
<parameters>${device_address}</parameters>
<addOutputToComment>false</addOutputToComment>
<waitForTerminate>true</waitForTerminate>
<timeout>60</timeout> <!-- seconds -->
</ActionScriptConfig>
plugin/actions/rebootRouter.pl
#!/usr/bin/perl -w
# DESCRIPTION:
# log in to a cisco router, switch to enable mode
# and reboot it
use Net::Telnet;
my $device_address = $ARGV[0]; # Passed from Traverse
my $login_user = "username"; # SET THIS
my $login_pass = "password"; # SET THIS
my $enable_pass = "enable"; # SET THIS
my $socket = new Net::Telnet (%PARAM);
$socket->open(Host => $device_address, Port => 23);
$socket->login($login_user, $login_pass);
$socket->print("enable");
$socket->print($enable_pass);
$socket->print("reload in 2 automated Traverse action");
$socket->print("exit");
$socket->close;
Note: This script sample does not include error management. It only highlights the basic commands for logging in to and rebooting a Cisco router.