SNMP

Check SNMP Uptime

Description:

Most Nagios checks are done every 5 minutes and a device can reboot without you knowing about it. This scrip can be used to check the uptime of a device, it will give a critical or a warning status when the uptime is bellow 15 or 30 minutes.

Current Version

0.1

Last Release Date

2011-07-16

Compatible With

  • Nagios 1.x
  • Nagios 2.x
  • Nagios 3.x
  • Nagios XI
  • Nagios Fusion

License

GPL


Project Files
Project Notes
Notes Most Nagios checks are done every 5 minutes and a device can reboot without you knowing about it. This scrip can be used to check the uptime of a device, it will give a critical or a warning status when the uptime is bellow 15 or 30 minutes. It will use the snmpEngineTime object to check the uptime of the SNMP engine. It doesn't use the sysUpTime as this is a 32-bit interger and will rollover after 496 days. If you are using Cisco device please be aware of bug CSCeh49492, this will cause the snmpEngineTime to reset when sysUpTime will rollover. You can fix this with an IOS upgrade. I have only tested this with various Cisco devices and a Linux machine. Please send me an e-mail with requests, bugs or patches. Leave a reply below if you like the plugin :) Michiel Timmers
Reviews (3) Add a Review
SNMP uptime, not OS uptime
by roddie, July 31, 2019

I understand this is 8 years old and there might be better alternatives people are using already, but in 2019 this was one of the first plugins that came up for a search of "nagios snmp uptime" so thought it was worth commenting on. Maybe it was the author's intention, but by using snmpEngineUptime instead of sysUpTime this plugin does not check the uptime of the OS/device, it checks the uptime of the SNMP daemon so it will show a different time if eg. snmpd has been restarted at any point. [root@server1 nagios]# ./check_snmp -H server2 -C public -o snmpEngineTime.0 -P 2c SNMP OK - 958 seconds | SNMP-FRAMEWORK-MIB::snmpEngineTime.0=958 [root@server1 nagios]# ./check_snmp -H server2 -C public -o sysUpTime.0 -P 2c SNMP OK - 96767 | DISMAN-EVENT-MIB::sysUpTimeInstance=96767



Worked Perfectly
by nishith, February 29, 2016

My "commands.cfg" file. define command{ command_name check_snmp_uptime command_line /usr/local/nagios/libexec/check_snmp_uptime.pl -H $HOSTADDRESS$ -C "$ARG1$" } ##################################### My "Linux.cfg" file define service{ use generic-service host_name cPanel service_description UPTIME check_command check_snmp_uptime!public } ####################### commands output: /usr/local/nagios/libexec/check_snmp_uptime.pl -H 192.168.1.1 -C public SNMP uptime: 35 days, 0 hours, 12 minutes, 21 seconds : OK #######################



Thank you!!
by redoute, July 31, 2013

This was exactly what I needed! Nice job! =)



Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
4.5 (4)
Favorites
1
Views
165,942