diff options
Diffstat (limited to 'plugins-scripts/check_sensors.sh')
-rwxr-xr-x | plugins-scripts/check_sensors.sh | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/plugins-scripts/check_sensors.sh b/plugins-scripts/check_sensors.sh index f742830..9a6cf5d 100755 --- a/plugins-scripts/check_sensors.sh +++ b/plugins-scripts/check_sensors.sh | |||
@@ -2,46 +2,46 @@ | |||
2 | 2 | ||
3 | PATH="@TRUSTED_PATH@" | 3 | PATH="@TRUSTED_PATH@" |
4 | export PATH | 4 | export PATH |
5 | PROGNAME=`basename $0` | 5 | PROGNAME=$(basename "$0") |
6 | PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` | 6 | PROGPATH=$(echo "$0" | sed -e 's,[\\/][^\\/][^\\/]*$,,') |
7 | REVISION="@NP_VERSION@" | 7 | REVISION="@NP_VERSION@" |
8 | 8 | ||
9 | . $PROGPATH/utils.sh | 9 | . "$PROGPATH"/utils.sh |
10 | 10 | ||
11 | print_usage() { | 11 | print_usage() { |
12 | echo "Usage: $PROGNAME" [--ignore-fault] | 12 | echo "Usage: $PROGNAME" [--ignore-fault] |
13 | } | 13 | } |
14 | 14 | ||
15 | print_help() { | 15 | print_help() { |
16 | print_revision $PROGNAME $REVISION | 16 | print_revision "$PROGNAME" "$REVISION" |
17 | echo "" | 17 | echo "" |
18 | print_usage | 18 | print_usage |
19 | echo "" | 19 | echo "" |
20 | echo "This plugin checks hardware status using the lm_sensors package." | 20 | echo "This plugin checks hardware status using the lm_sensors package." |
21 | echo "" | 21 | echo "" |
22 | support | 22 | support |
23 | exit $STATE_OK | 23 | exit "$STATE_OK" |
24 | } | 24 | } |
25 | 25 | ||
26 | case "$1" in | 26 | case "$1" in |
27 | --help) | 27 | --help) |
28 | print_help | 28 | print_help |
29 | exit $STATE_OK | 29 | exit "$STATE_OK" |
30 | ;; | 30 | ;; |
31 | -h) | 31 | -h) |
32 | print_help | 32 | print_help |
33 | exit $STATE_OK | 33 | exit "$STATE_OK" |
34 | ;; | 34 | ;; |
35 | --version) | 35 | --version) |
36 | print_revision $PROGNAME $REVISION | 36 | print_revision "$PROGNAME" "$REVISION" |
37 | exit $STATE_OK | 37 | exit "$STATE_OK" |
38 | ;; | 38 | ;; |
39 | -V) | 39 | -V) |
40 | print_revision $PROGNAME $REVISION | 40 | print_revision "$PROGNAME" "$REVISION" |
41 | exit $STATE_OK | 41 | exit "$STATE_OK" |
42 | ;; | 42 | ;; |
43 | *) | 43 | *) |
44 | sensordata=`sensors 2>&1` | 44 | sensordata=$(sensors 2>&1) |
45 | status=$? | 45 | status=$? |
46 | if test ${status} -eq 127; then | 46 | if test ${status} -eq 127; then |
47 | text="SENSORS UNKNOWN - command not found (did you install lmsensors?)" | 47 | text="SENSORS UNKNOWN - command not found (did you install lmsensors?)" |
@@ -49,10 +49,10 @@ case "$1" in | |||
49 | elif test ${status} -ne 0; then | 49 | elif test ${status} -ne 0; then |
50 | text="WARNING - sensors returned state $status" | 50 | text="WARNING - sensors returned state $status" |
51 | exit=$STATE_WARNING | 51 | exit=$STATE_WARNING |
52 | elif echo ${sensordata} | egrep ALARM > /dev/null; then | 52 | elif echo "${sensordata}" | egrep ALARM > /dev/null; then |
53 | text="SENSOR CRITICAL - Sensor alarm detected!" | 53 | text="SENSOR CRITICAL - Sensor alarm detected!" |
54 | exit=$STATE_CRITICAL | 54 | exit=$STATE_CRITICAL |
55 | elif echo ${sensordata} | egrep FAULT > /dev/null \ | 55 | elif echo "${sensordata}" | egrep FAULT > /dev/null \ |
56 | && test "$1" != "-i" -a "$1" != "--ignore-fault"; then | 56 | && test "$1" != "-i" -a "$1" != "--ignore-fault"; then |
57 | text="SENSOR UNKNOWN - Sensor reported fault" | 57 | text="SENSOR UNKNOWN - Sensor reported fault" |
58 | exit=$STATE_UNKNOWN | 58 | exit=$STATE_UNKNOWN |
@@ -63,8 +63,8 @@ case "$1" in | |||
63 | 63 | ||
64 | echo "$text" | 64 | echo "$text" |
65 | if test "$1" = "-v" -o "$1" = "--verbose"; then | 65 | if test "$1" = "-v" -o "$1" = "--verbose"; then |
66 | echo ${sensordata} | 66 | echo "${sensordata}" |
67 | fi | 67 | fi |
68 | exit $exit | 68 | exit "$exit" |
69 | ;; | 69 | ;; |
70 | esac | 70 | esac |