Perl
I’ve coded in Perl for the better part of the past 18 years. Unfortunately very little time is ever spent cleaning up the code to make it more efficient, more modular, easier to read and/or follow (especially helpful while trying to debug). I’ve generally used Perl to pull data via SNMP and build reports. I have also used Perl to build web based applications using SNMP to configure different network switch settings (link speed, duplex, VLAN configuration, etc).
There are probably only four or five real Perl applications that I’ve built over those 10 years. All others have been adoptions of one of the original applications to suite a need or address a problem.
These scripts are NOT meant to be simply downloaded and installed into another system/server/network. They are provided as examples of what is possible to help others along the same path I’ve already traveled. If you are knowledgeable in Perl you could certainly take these scripts and adopt them to your own environment.
portreport.pl | This script gathers the list of available and busy Ethernet ports in the network. It provides a means for us to gauge which ports are actually being used over which are just patched (cross connected to a data jack). This script just looks at the ifInOctets for each port and tracks changes across time. The script maps ifIndex numbers to real card/switch port information for chassis and stackable switches. |
– | |
pingsweep.pl | This is a poor mans network management application. It’s purpose is to poll (ICMP) a list of devices on the network every 60 seconds. It records and alerts when any device goes down and it records and alerts again when that device recovers. It shells out to fping to actually perform the ICMP pings. I’ve run this script from a single VM server to manage the availability of over 900 devices on the network – it’s very lean and mean. |
– | |
reportdowntime.pl | This script takes the data collected from the pingsweep.pl script and formulates a downtime report for all the devices being monitored. It will generate a monthly % of uptime so you can gauge your networks performance. |
– | |
switchtftpbackup.pl | This script will backup the switch configurations of the following switches to a TFTP server; Nortel ERS 8600, ERS 1648, ERS 5500, ES 470, ES 460 and ES 450. It will also backup a HP GbE2 switch blade along with a Motorola WS5100 (v3.x software) Wireless LAN Switch. |
– | |
switchupgrade.pl | This script will upgrade a switches boot and agent code. This script allows us to upgrade ~ 40 switches within a 30 minute period (impossible to accomplish if this was attempted manually). |
– | |
passportarp.pl | This is a Web CGI script that will try to locate a specific device connected to a Nortel Ethernet Routing Switch 8600. The script queries the IP ARP table of the switch and tries to identify the switch card and port the device is connected to. You will need the Net-SNMP perl libraries, CGI and DBI Perl modules along with the RAPID-CITY SNMP mib in order to run this script. |
Expect
Expect is a great tool that is often overlooked by the vast majority. I’ve used Expect while troubleshooting a number of high profile problems where I needed to collect switch topology information while a problem was detected or trigger reached (often between 1AM and 4AM and only lasting a few minutes).
From the Expect Homepage “Expect is a tool for automating interactive applications such as telnet, ftp, passwd, fsck, rlogin, tip, etc. Expect really makes this stuff trivial. Expect is also useful for testing these same applications.” If your looking to learn Expect let me recommend the O’Reilly book “Exploring Expect“. |
8600dump.exp | This Expect script telnets to a Nortel ERS 8600 switch and issues several commands, saving the output. |
– | |
8600dump.sh | This Bash shell script automates the process of calling 8600dump.exp when working with multiple Nortel ERS 8600 switches. I didn’t combine the two because I often call this Expect script from other scripts. |
Cheers!