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

Uptime through SNMP

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

Help Support Ethan Galstad's New Project:

Help Support Ethan

A Message From The Founder...

As the founder of Nagios, I'm asking for your help in a cause that's dear to my heart.

I'm launching a new project to help better the world by providing the information, ideas, and inspiration that I believe can improve the lives of people everywhere.

I know you're busy managing networks, but I would appreciate it if you would consider liking my Facebook page and showing your support for the content and messages I produce by sharing them with your friends and family.

You can learn more about my project by visiting ethangalstad.me/nagios. Thank you for your time. I wish you all the best in your endeavors, whatever they may be.

- Ethan

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