[nagiosplug] check_sensors: Use symbolic exit codes
Holger Weiss
hweiss at users.sourceforge.net
Wed Sep 7 14:10:22 CEST 2011
Module: nagiosplug
Branch: master
Commit: 5532dbe48a485edb7f75c5058a2aac87090f66d3
Author: Holger Weiss <holger at zedat.fu-berlin.de>
Date: Wed Sep 7 14:04:01 2011 +0200
URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=5532dbe
check_sensors: Use symbolic exit codes
Specify the exit codes by using the constants from utils.sh.
---
plugins-scripts/check_sensors.sh | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/plugins-scripts/check_sensors.sh b/plugins-scripts/check_sensors.sh
index 660b721..ffaa974 100755
--- a/plugins-scripts/check_sensors.sh
+++ b/plugins-scripts/check_sensors.sh
@@ -21,25 +21,25 @@ print_help() {
echo "This plugin checks hardware status using the lm_sensors package."
echo ""
support
- exit 0
+ exit $STATE_OK
}
case "$1" in
--help)
print_help
- exit 0
+ exit $STATE_OK
;;
-h)
print_help
- exit 0
+ exit $STATE_OK
;;
--version)
print_revision $PROGNAME $REVISION
- exit 0
+ exit $STATE_OK
;;
-V)
print_revision $PROGNAME $REVISION
- exit 0
+ exit $STATE_OK
;;
*)
sensordata=`sensors 2>&1`
@@ -49,20 +49,20 @@ case "$1" in
fi
if test ${status} -eq 127; then
echo "SENSORS UNKNOWN - command not found (did you install lmsensors?)"
- exit -1
+ exit $STATE_UNKNOWN
elif test ${status} -ne 0; then
echo "WARNING - sensors returned state $status"
- exit 1
+ exit $STATE_WARNING
fi
if echo ${sensordata} | egrep ALARM > /dev/null; then
echo SENSOR CRITICAL - Sensor alarm detected!
- exit 2
+ exit $STATE_CRITICAL
elif echo ${sensordata} | egrep FAULT > /dev/null \
&& test "$1" != "-i" -a "$1" != "--ignore-fault"; then
echo SENSOR UNKNOWN - Sensor reported fault
- exit 3
+ exit $STATE_UNKNOWN
fi
echo sensor ok
- exit 0
+ exit $STATE_OK
;;
esac
More information about the Commits
mailing list