I’ve coded in Perl for the better part of the past 10 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.
|pingsweep.pl||This is almost 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 when that device recovers. It shells out to fping to actually perform the ICMP pings.|
|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).|
|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).|
|symbolusers.pl||This is a Web CGI script that is used to manage a Motorola (formerly Symbol) WS5100 v2.x Wireless LAN Switch. It just displays the wireless mobile units that are associated (connected) to the wireless switch. It will also display any Access Ports that are configured but are not online for whatever reason.|
|symbolusers.tmpl||This is the HTML template used by the Perl script symbolusers.pl. See http://html-template.sourceforge.net/|
|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. Download the script here by right-clicking and selecting “Save As”|
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.|
|backup-symbolswitches.exp||This Expect script telnets into a Motorola (formerly Symbol) WS5000/WS5100 Wireless LAN Switch and issues several commands to backup it’s configuration and copy it to a TFTP server|
|backup-symbolswitches.sh||This Bash shell script automates the process of calling backup-symbolswitches.exp when working with multiple WS5000/WS5100 Wireless LAN Switches.|
|callserver_settime.exp||This Expect script rlogins into a Nortel Call Server 1000 (CS1K/PBX) and sets the time from the local time on the workstation running the script.|