
SNMP
Uptime through SNMP
Description:
Checks the hosts uptime through SNMP. Based on uptime_by_snmp.sh but improved (help, no tempfiles, output in minutes and days).
Current Version
Last Release Date
June 23, 2009
Compatible With
Owner
Project Files
File | Description |
---|---|
uptime.sh | Shellscript for checking hosts uptime with SNMP |
uptime.sh-rev.02 | Rev. 0.2: minmal bugfix in error message |
Project Notes
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)
Add a Review
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
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
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
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
Add a Review
You must be logged in to submit a review.
Thank you for your review!
Your review has been submitted and is pending approval.
Recommend
To:
From:
Thank you for your recommendation!
Your recommendation has been sent.
Page Sections
Project Stats
Rating
3.3 (3)
Favorites
0
Views
162,400