summaryrefslogtreecommitdiffstats
path: root/contrib/check_adptraid.sh
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/check_adptraid.sh')
-rw-r--r--contrib/check_adptraid.sh75
1 files changed, 75 insertions, 0 deletions
diff --git a/contrib/check_adptraid.sh b/contrib/check_adptraid.sh
new file mode 100644
index 00000000..d7f8d0c3
--- /dev/null
+++ b/contrib/check_adptraid.sh
@@ -0,0 +1,75 @@
1#! /bin/sh
2#
3# Modified check_sensors to check the alarm status of an Adaptec 3200S RAID
4# controller.
5#
6# Scott Lambert -- lambert@lambertfam.org
7#
8# Tested on FreeBSD 4.7 with the adptfbsd_323.tgz package installed. This
9# package installs all it's programs into /usr/dpt.
10#
11
12PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
13
14PROGNAME=`basename $0`
15PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
16REVISION=`echo '$Revision$' | sed -e 's/[^0-9.]//g'`
17
18. $PROGPATH/utils.sh
19
20RAIDUTIL_CMD="/usr/dpt/raidutil -A ?"
21
22print_usage() {
23 echo "Usage: $PROGNAME"
24}
25
26print_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
35}
36
37case "$1" in
38 --help)
39 print_help
40 exit 0
41 ;;
42 -h)
43 print_help
44 exit 0
45 ;;
46 --version)
47 print_revision $PROGNAME $REVISION
48 exit 0
49 ;;
50 -V)
51 print_revision $PROGNAME $REVISION
52 exit 0
53 ;;
54 *)
55 raidutiloutput=`$RAIDUTIL_CMD 2>&1`
56 status=$?
57 if test "$1" = "-v" -o "$1" = "--verbose"; then
58 echo ${raidutiloutput}
59 fi
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
66 fi
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
73 fi
74 ;;
75esac