This script monitors the temperature of a Cisco catalyst via SNMP.

It requests some data of a catalyst via SNMP to analyze them and notifies you via Nagios if the switch is getting to hot. To learn how to enable SNMP in your catalyst’s IOS scroll down.

This script should be called with -s [SWITCHIP] , -C [COMMUNITYSTRING] , -w [WARNLEVEL] and -c [CRITLEVEL] . For more information just run it with -h .

Tested with different IOS versions and SNMP protocol version 2c. If you want to use a different SNMP protocol version, just modify the Net::SNMP->session(...) call.

Here is the code.

How to enable SNMP in your catalyst's IOS

To allow an server to access the IOS via SNMP you have to create an access list with the IP of your server. Afterwards define the access to the IOS’s SNMP-server with an community string, similar like a passphrase. Here is an example configuration:

access-list 60 permit [IP-THAT-IS-ALLOWED-TO-REQUEST]
snmp-server community [COMMUNITY-STRING] RO 60

For more information just ask one of these search engines out there.

Dependencies

Please consider to take a look at my general setup notes.

Download: Perl: check_catalyst_temp.pl (Please take a look at the man-page. Browse bugs and feature requests.)

Martin Scharm

stuff. just for the records.

Do you like this page?
You can actively support me!

1 comment

kvolaa | Permalink |

On C2960G-48 this OIDs don’t exist. You can use CISCO-STACK-MIB::chassisTempAlarm.0 , which return off(1) in normal state and on(2) when overheating ( OID 1.3.6.1.4.1.9.5.1.2.13.0 ). The same is about fan, CISCO-STACK-MIB::chassisFanStatus.0 return ok(2) in normal state ( OID 1.3.6.1.4.1.9.5.1.2.9.0 ). In IOS, you got:

Switch5#show env all
FAN is OK
TEMPERATURE is OK

POWER is OK
RPS is NOT PRESENT

but:

Switch5#show env temperature status
Temperature Value: Not Supported
Temperature State: Not Supported

Leave a comment

There are multiple options to leave a comment: