diff options
author | Stanley Hopcroft <stanleyhopcroft@users.sourceforge.net> | 2004-11-25 04:30:04 +0000 |
---|---|---|
committer | Stanley Hopcroft <stanleyhopcroft@users.sourceforge.net> | 2004-11-25 04:30:04 +0000 |
commit | 3d3d53f407c8e5c355a0175b9f49d47a40131026 (patch) | |
tree | 8100ae3420717b29d8d86281de416bdcd8ceaa08 /contrib/check_hw.sh | |
parent | a5f2507a2b4a2fb0fee12a2af0f57853d5056095 (diff) | |
download | monitoring-plugins-3d3d53f407c8e5c355a0175b9f49d47a40131026.tar.gz |
Added /contrib/check_hw.sh by Rok Debevc
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@939 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'contrib/check_hw.sh')
-rw-r--r-- | contrib/check_hw.sh | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/contrib/check_hw.sh b/contrib/check_hw.sh new file mode 100644 index 00000000..f03398ea --- /dev/null +++ b/contrib/check_hw.sh | |||
@@ -0,0 +1,66 @@ | |||
1 | #! /bin/sh | ||
2 | # | ||
3 | # Tested on SuSE 9.1 Professional with the hwinfo-8.62-0.2 package installed. | ||
4 | # | ||
5 | # Before you can run this plugin, you must do: | ||
6 | # /usr/sbin/hwinfo --short > /etc/hw.original | ||
7 | # add to cron job: | ||
8 | # /usr/sbin/hwinfo --short > /etc/hw.current | ||
9 | # /usr/bin/diff /etc/hw.original /etc/hw.current > /tmp/hw.check | ||
10 | # | ||
11 | # | ||
12 | # Rok Debevc -- rok.debevc@agenda.si | ||
13 | # | ||
14 | # | ||
15 | PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin | ||
16 | |||
17 | PROGNAME=`basename $0` | ||
18 | PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` | ||
19 | REVISION=`echo '$Revision$' | sed -e 's/[^0-9.]//g'` | ||
20 | |||
21 | . $PROGPATH/utils.sh | ||
22 | |||
23 | |||
24 | print_usage() { | ||
25 | echo "Usage: $PROGNAME" | ||
26 | } | ||
27 | |||
28 | print_help() { | ||
29 | print_revision $PROGNAME $REVISION | ||
30 | echo "" | ||
31 | print_usage | ||
32 | echo "" | ||
33 | echo "This plugin checks hardware changes." | ||
34 | echo "" | ||
35 | support | ||
36 | exit 0 | ||
37 | } | ||
38 | |||
39 | case "$1" in | ||
40 | --help) | ||
41 | print_help | ||
42 | exit 0 | ||
43 | ;; | ||
44 | -h) | ||
45 | print_help | ||
46 | exit 0 | ||
47 | ;; | ||
48 | --version) | ||
49 | print_revision $PROGNAME $REVISION | ||
50 | exit 0 | ||
51 | ;; | ||
52 | -V) | ||
53 | print_revision $PROGNAME $REVISION | ||
54 | exit 0 | ||
55 | ;; | ||
56 | *) | ||
57 | if `du /tmp/hw.check | cut -c 1|grep "^[0]" > /dev/null` ; then | ||
58 | echo No hardware is changed | ||
59 | exit 0 | ||
60 | else | ||
61 | echo ***hardware is changed*** look into /tmp/hw.check | ||
62 | exit 2 | ||
63 | fi | ||
64 | ;; | ||
65 | esac | ||
66 | |||