Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Check SNMP Uptime
0.1
2011-07-16
- Nagios 1.x
- Nagios 2.x
- Nagios 3.x
- Nagios XI
- Nagios Fusion
GPL
166080
File | Description |
---|---|
check_snmp_uptime.pl | check_snmp_uptime.pl |
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
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
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)
byroddie, July 11, 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
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
#######################
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! =)