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

Uptime through SNMP

Rating
3 votes
Favoured:
0
Hits
162398
Files:
FileDescription
uptime.shShellscript for checking hosts uptime with SNMP
uptime.sh-rev.02Rev. 0.2: minmal bugfix in error message
Nagios CSP

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!
Checks the hosts uptime through SNMP. Based on uptime_by_snmp.sh but improved (help, no tempfiles, output in minutes and days).
Checks the hosts uptime through SNMP. Based on uptime_by_snmp.sh but conforms more to the guidlines (no tempfiles, help). The output is in minutes (if critcial or warning), otherwise in days.
Can be used to check any host (*nix, Windows).
To change German output, pls. go into the script and change Tage to days.
Reviews (2)
This plugin uses DISMAN-EVENT-MIB::sysUpTimeInstance which expresses uptime in 1/100 sec in a 32-bit value. So it will roll over in 496 days and may result in spurious alerts at that time.

If your device supports SNMP-FRAMEWORK-MIB::snmpEngineTime.0 (.1.3.6.1.6.3.10.2.1.3.0) that OID's result is expressed in seconds and can be monitored by simply using check_snmp.

check_snmp -H router -C public -o SNMP-FRAMEWORK-MIB::snmpEngineTime.0 -c 2000
byswerrie, February 10, 2010
no Perf data and the plugin shows not very accurate info...

But it works like a charm... I've edited myself for my needs:

if [ $RES = 0 ]; then
UPTDAY=$(expr $UPTMIN / 60 / 24 )
UPTMINT=$(( $UPTDAY * 1440 ))
UPTMINM=$(( $UPTMIN - $UPTMINT ))
UPTMINH=$(expr $UPTMINM / 60 )
UPTMINHM=$(( $UPTMINH * 60 ))
UPTMINHMS=$(( $UPTMINM - $UPTMINHM ))

if [ $UPTMIN -lt $CRIT ]; then
echo CRITICAL: Systemuptime $UPTDAY Days $UPTMINH Hours $UPTMINHMS Mins'|Uptime='$UPTMIN'm;'$WARN';'$CRIT';0;0'
exit 2
fi

if [ $UPTMIN -lt $WARN ]; then
echo OK: Systemuptime $UPTDAY Days $UPTMINH Hours $UPTMINHMS Mins'|Uptime='$UPTMIN'm;'$WARN';'$CRIT';0;0'
exit 0
fi

if [ $UPTMIN -ge $WARN ]; then
echo WARNING: Systemuptime $UPTDAY Days $UPTMINH Hours $UPTMINHMS Mins'|Uptime='$UPTMIN'm;'$WARN';'$CRIT';0;0'
exit 1
fi

fi