extreme_traphandle

This is a traphandler for Net-SNMP which can handle several diffrent Extreme Network gear traps. The handler will log all traps, and send mail to a list of recipients for serious problems. You can see ports up and down as they happen, componant changes, state changes, and some added information such as when a new board is added to the BlackDiamond you'll see its new serial number. This is a good method of monitoring your gear day to day, and for paging purposes.

The traphandler outputs two diffrent log files, one with clean traps that the script has recognized, reformated and put in the log in a nice clean way, here is a look at some lines from that log:

Thu Dec 12 16.04.18 PST 2002. A statechange for 10.10.0.239 has occured. Module fe32 in slot 2 changed state to notPresent
Thu Dec 12 16.04.29 PST 2002. A statechange for 10.10.0.239 has occured. Module fe32 in slot 2 changed state to operational
Thu Dec 12 16:04:29 PST 2002: New fe32 module in slot 2 has serial number: "701005-XX-XXXXXXXXXX"
Fri Dec 13 12.33.09 PST 2002. A statechange for 10.10.0.239 has occured. Module fe32 in slot 2 changed state to notPresent
Fri Dec 13 15.26.24 PST 2002. A statechange for 10.10.0.239 has occured. Module fe32 in slot 2 changed state to operational
Fri Dec 13 15:26:24 PST 2002: New fe32 module in slot 2 has serial number: "701005-XX-XXXXXXXXXX"
Fri Dec 13 15:31:06 PST 2002: Port Change on 10.10.0.239: PORT 5/5 STATE: up HOST: up
Fri Dec 13 15:31:10 PST 2002: Port Change on 10.10.0.239: PORT 5/5 STATE: up HOST: down
Fri Dec 13 17.26.25 PST 2002. HEALTH CHECK FAILURE FOR 10.100.2.250 ON SLOT 4. TYPE. hardwareFail ACTION. healthCheckTrap MAX RESETS. 0
Fri Dec 13 17.27.07 PST 2002. HEALTH CHECK FAILURE FOR 10.100.2.250 ON SLOT 4. TYPE. hardwareFail ACTION. healthCheckTrap MAX RESETS. 0
Fri Dec 13 18.15.12 PST 2002. A statechange for 10.100.2.249 has occured. Module msm64i in slot B changed state to notPresent
Fri Dec 13 18:15:12 PST 2002: Port Change on 10.100.2.250: PORT 6/5 STATE: up HOST: down

The second log is a catch-all, if the script doesn't know what it is, it dumps the trap into the second file in a raw, human readable form to allow you to update/modify the script if you choose, or just double check things.

An added bonus of this script is that for some situations, if you have festival configured, the script will actually SPEAK the warnings! You can hear your machine say "A port state change has occurred for port blah blah"! Totally kool. Not useful really, but better than tailing the log all day. And, btw, the clean output messages are ment to be one liner short messages to allow easy tailing, just in case.

The script also will send mail on traps. My SkyTel pager can accept email as pages, so I use this as the paging system too. In each trap check you'll see a call like this "&__send_mail();". This calls the subroutine to send the mail. If you don't want to be anoyed by, say, Port State changes, then just comment out the call. Do NOT comment out the $MESSAGE, as this message goes to both the MTA AND the log!


Download: extreme_traphandle.pl
Requirements: Net-SNMP 5.x, the Extreme MIB*
Optional Requirements: Festival, Festival::Client 1.0**
License: GNU Public License

*NOTE: You must change the variable $MIB in the header to point to the MIB file
**NOTE: You can turn off speech by changing the variable $SPEAK to "no" and commenting out the "use Festival::Client;" line