Build precise queries to find exactly what you need
Press ESC to close
Your review has been submitted and is pending approval.
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
Owner
Michiel Timmers
License
GPL
Compatible With
<u><b>Notes</b></u> 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 :)
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
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 #######################
This was exactly what I needed! Nice job! =)
You must be logged in to submit a review.
To:
From: