Fixed typo in check_disk
[monitoring-plugins.git] / contrib / check_adptraid.sh
blobe3c47bee8144fdbc0a628b2e23de1edb8de9152a
1 #! /bin/sh
3 # Modified check_sensors to check the alarm status of an Adaptec 3200S RAID
4 # controller.
6 # Scott Lambert -- lambert@lambertfam.org
8 # Tested on FreeBSD 4.7 with the adptfbsd_323.tgz package installed. This
9 # package installs all it's programs into /usr/dpt.
12 PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
14 PROGNAME=`basename $0`
15 PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
16 REVISION=`echo '$Revision: 302 $' | sed -e 's/[^0-9.]//g'`
18 . $PROGPATH/utils.sh
20 RAIDUTIL_CMD="/usr/dpt/raidutil -A ?"
22 print_usage() {
23 echo "Usage: $PROGNAME"
26 print_help() {
27 print_revision $PROGNAME $REVISION
28 echo ""
29 print_usage
30 echo ""
31 echo "This plugin checks alarm status of Adaptec 3200S RAID controller."
32 echo ""
33 support
34 exit 0
37 case "$1" in
38 --help)
39 print_help
40 exit 0
42 -h)
43 print_help
44 exit 0
46 --version)
47 print_revision $PROGNAME $REVISION
48 exit 0
50 -V)
51 print_revision $PROGNAME $REVISION
52 exit 0
55 raidutiloutput=`$RAIDUTIL_CMD 2>&1`
56 status=$?
57 if test "$1" = "-v" -o "$1" = "--verbose"; then
58 echo ${raidutiloutput}
60 if test ${status} -eq 127; then
61 echo "RAIDUTIL UNKNOWN - command not found (did you install raidutil?)"
62 exit -1
63 elif test ${status} -ne 0 ; then
64 echo "WARNING - raidutil returned state $status"
65 exit 1
67 if echo ${raidutiloutput} | egrep On > /dev/null; then
68 echo RAID CRITICAL - RAID alarm detected!
69 exit 2
70 else
71 echo raid ok
72 exit 0
75 esac