diff options
author | Sven Nierlein <sven@nierlein.org> | 2013-08-15 09:33:07 (GMT) |
---|---|---|
committer | Sven Nierlein <sven@nierlein.org> | 2013-08-15 09:33:07 (GMT) |
commit | bc4ca2b348f9a90290e3f1b7e345981de5c699d1 (patch) | |
tree | d96257121e99f91fe5200eef2c104eceb542c67f /plugins-scripts | |
parent | bb3bf05856dc4feafca78c5f83edd48e6bde8064 (diff) | |
parent | 774647f60ccee69f0cd033b5411e36441f03c84a (diff) | |
download | monitoring-plugins-bc4ca2b348f9a90290e3f1b7e345981de5c699d1.tar.gz |
Merge pull request #49 from gtozzi/master
Fixed check_sensors to display correct verbose output
Diffstat (limited to 'plugins-scripts')
-rwxr-xr-x | plugins-scripts/check_sensors.sh | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/plugins-scripts/check_sensors.sh b/plugins-scripts/check_sensors.sh index ffaa974..874e104 100755 --- a/plugins-scripts/check_sensors.sh +++ b/plugins-scripts/check_sensors.sh | |||
@@ -44,25 +44,28 @@ case "$1" in | |||
44 | *) | 44 | *) |
45 | sensordata=`sensors 2>&1` | 45 | sensordata=`sensors 2>&1` |
46 | status=$? | 46 | status=$? |
47 | if test "$1" = "-v" -o "$1" = "--verbose"; then | ||
48 | echo ${sensordata} | ||
49 | fi | ||
50 | if test ${status} -eq 127; then | 47 | if test ${status} -eq 127; then |
51 | echo "SENSORS UNKNOWN - command not found (did you install lmsensors?)" | 48 | text="SENSORS UNKNOWN - command not found (did you install lmsensors?)" |
52 | exit $STATE_UNKNOWN | 49 | exit=$STATE_UNKNOWN |
53 | elif test ${status} -ne 0; then | 50 | elif test ${status} -ne 0; then |
54 | echo "WARNING - sensors returned state $status" | 51 | text="WARNING - sensors returned state $status" |
55 | exit $STATE_WARNING | 52 | exit=$STATE_WARNING |
56 | fi | 53 | elif echo ${sensordata} | egrep ALARM > /dev/null; then |
57 | if echo ${sensordata} | egrep ALARM > /dev/null; then | 54 | text="SENSOR CRITICAL - Sensor alarm detected!" |
58 | echo SENSOR CRITICAL - Sensor alarm detected! | 55 | exit=$STATE_CRITICAL |
59 | exit $STATE_CRITICAL | ||
60 | elif echo ${sensordata} | egrep FAULT > /dev/null \ | 56 | elif echo ${sensordata} | egrep FAULT > /dev/null \ |
61 | && test "$1" != "-i" -a "$1" != "--ignore-fault"; then | 57 | && test "$1" != "-i" -a "$1" != "--ignore-fault"; then |
62 | echo SENSOR UNKNOWN - Sensor reported fault | 58 | text="SENSOR UNKNOWN - Sensor reported fault" |
63 | exit $STATE_UNKNOWN | 59 | exit=$STATE_UNKNOWN |
60 | else | ||
61 | text="SENSORS OK" | ||
62 | exit=$STATE_OK | ||
64 | fi | 63 | fi |
65 | echo sensor ok | 64 | |
66 | exit $STATE_OK | 65 | echo "$text" |
66 | if test "$1" = "-v" -o "$1" = "--verbose"; then | ||
67 | echo ${sensordata} | ||
68 | fi | ||
69 | exit $exit | ||
67 | ;; | 70 | ;; |
68 | esac | 71 | esac |