summaryrefslogtreecommitdiffstats
path: root/plugins-scripts/check_sensors.sh
diff options
context:
space:
mode:
authorEthan Galstad <egalstad@users.sourceforge.net>2002-02-28 06:42:51 (GMT)
committerEthan Galstad <egalstad@users.sourceforge.net>2002-02-28 06:42:51 (GMT)
commit44a321cb8a42d6c0ea2d96a1086a17f2134c89cc (patch)
treea1a4d9f7b92412a17ab08f34f04eec45433048b7 /plugins-scripts/check_sensors.sh
parent54fd5d7022ff2d6a59bc52b8869182f3fc77a058 (diff)
downloadmonitoring-plugins-44a321cb8a42d6c0ea2d96a1086a17f2134c89cc.tar.gz
Initial revision
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins-scripts/check_sensors.sh')
-rwxr-xr-xplugins-scripts/check_sensors.sh65
1 files changed, 65 insertions, 0 deletions
diff --git a/plugins-scripts/check_sensors.sh b/plugins-scripts/check_sensors.sh
new file mode 100755
index 0000000..011aa70
--- /dev/null
+++ b/plugins-scripts/check_sensors.sh
@@ -0,0 +1,65 @@
1#! /bin/sh
2
3PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
4
5PROGNAME=`basename $0`
6PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
7REVISION=`echo '$Revision$' | sed -e 's/[^0-9.]//g'`
8
9. $PROGPATH/utils.sh
10
11
12print_usage() {
13 echo "Usage: $PROGNAME"
14}
15
16print_help() {
17 print_revision $PROGNAME $REVISION
18 echo ""
19 print_usage
20 echo ""
21 echo "This plugin checks hardware status using the lm_sensors package."
22 echo ""
23 support
24 exit 0
25}
26
27case "$1" in
28 --help)
29 print_help
30 exit 0
31 ;;
32 -h)
33 print_help
34 exit 0
35 ;;
36 --version)
37 print_revision $PROGNAME $REVISION
38 exit 0
39 ;;
40 -V)
41 print_revision $PROGNAME $REVISION
42 exit 0
43 ;;
44 *)
45 sensordata=`sensors 2>&1`
46 status=$?
47 if test "$1" = "-v" -o "$1" = "--verbose"; then
48 echo ${sensordata}
49 fi
50 if test ${status} -eq 127; then
51 echo "SENSORS UNKNOWN - command not found (did you install lmsensors?)"
52 exit -1
53 elif test ${status} -ne 0 ; then
54 echo "WARNING - sensors returned state $status"
55 exit 1
56 fi
57 if echo ${sensordata} | egrep ALARM > /dev/null; then
58 echo SENSOR CRITICAL - Sensor alarm detected!
59 exit 2
60 else
61 echo sensor ok
62 exit 0
63 fi
64 ;;
65esac