Make your own free website on Tripod.com

Perl Scripts for Routers

Home Page

You can use these scripts in any way you want and welcome to send questions/suggestions. I am in no way responsible for any problems you come across using these scripts.

I put some working Perl scripts for Unix administration on this page. I also put some explanation notes for easy understanding of the scripts. I tried not to use the in-built system tools where ever possible just to get a hang of the Perl scripting. So some times these scripts may not be the efficient way to deal with the problem. I hope these scripts are useful understanding the basics of Perl in day to day System's administration.

Perl Script to automatically telnet and get 'command results' from hosts

I used the module Comm.pl written by Eric Arnold and developed the scripts here to automatically telnet and run commands on the routers. This script can be modified to run the script on any host that can accept telnet sessions. The examples on using Comm.pl are available at the end Comm.pl. 

The script rexec.pl is one way of remotely running the commands. The script runs the commands supplied on the command line and stores the results in a file.

Running "perl rexec.pl' displays the syntax.            

Download all from here (Right click and save the files)

A modified version rping.pl uses external file with commands "cmds" and supplies the ping results to an MRTG script.

You could use an entry as shown below in the crontab to generate online latency graphs.

0,5,10,15,20,25,30,35,40,45,50,55 * * *  /usr/local/src/mrtg-2.9.12a/bin/mrtg /export/home/mrtg/r1.cfg > /dev/null 2>&1

Result display

These scripts can be used to run any number of commands on the routers.

Download from here

Home Page