aboutsummaryrefslogtreecommitdiff
path: root/contrib/check_hw.sh
diff options
context:
space:
mode:
authorGravatar Stanley Hopcroft <stanleyhopcroft@users.sourceforge.net> 2004-11-25 04:30:04 +0000
committerGravatar Stanley Hopcroft <stanleyhopcroft@users.sourceforge.net> 2004-11-25 04:30:04 +0000
commit3d3d53f407c8e5c355a0175b9f49d47a40131026 (patch)
tree8100ae3420717b29d8d86281de416bdcd8ceaa08 /contrib/check_hw.sh
parenta5f2507a2b4a2fb0fee12a2af0f57853d5056095 (diff)
downloadmonitoring-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.sh66
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 @@
+#! /bin/sh
+#
+# Tested on SuSE 9.1 Professional with the hwinfo-8.62-0.2 package installed.
+#
+# Before you can run this plugin, you must do:
+# /usr/sbin/hwinfo --short > /etc/hw.original
+# add to cron job:
+# /usr/sbin/hwinfo --short > /etc/hw.current
+# /usr/bin/diff /etc/hw.original /etc/hw.current > /tmp/hw.check
+#
+#
+# Rok Debevc -- rok.debevc@agenda.si
+#
+#
+PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
+
+PROGNAME=`basename $0`
+PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
+REVISION=`echo '$Revision$' | sed -e 's/[^0-9.]//g'`
+
+. $PROGPATH/utils.sh
+
+
+print_usage() {
+ echo "Usage: $PROGNAME"
+}
+
+print_help() {
+ print_revision $PROGNAME $REVISION
+ echo ""
+ print_usage
+ echo ""
+ echo "This plugin checks hardware changes."
+ echo ""
+ support
+ exit 0
+}
+
+case "$1" in
+ --help)
+ print_help
+ exit 0
+ ;;
+ -h)
+ print_help
+ exit 0
+ ;;
+ --version)
+ print_revision $PROGNAME $REVISION
+ exit 0
+ ;;
+ -V)
+ print_revision $PROGNAME $REVISION
+ exit 0
+ ;;
+ *)
+ if `du /tmp/hw.check | cut -c 1|grep "^[0]" > /dev/null` ; then
+ echo No hardware is changed
+ exit 0
+ else
+ echo ***hardware is changed*** look into /tmp/hw.check
+ exit 2
+ fi
+ ;;
+esac
+