Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

Check SNMP Uptime

Rating
4 votes
Favoured:
1
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
Hits
164976
Files:
FileDescription
check_snmp_uptime.plcheck_snmp_uptime.pl
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
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.
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)
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
bynishith, February 2, 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
#######################
byredoute, July 22, 2013
This was exactly what I needed! Nice job! =)