From: Alexander Barton Date: Tue, 9 Aug 2011 14:47:49 +0000 (+0200) Subject: RAID.tst: Add support for Apple hardware RAID cards X-Git-Tag: rel-3~15 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=nagcollect.git;a=commitdiff_plain;h=e0eabde357d1cc3849c7a661aeb0b7055296068c RAID.tst: Add support for Apple hardware RAID cards --- diff --git a/client/lib/tests/RAID.tst b/client/lib/tests/RAID.tst index 522acd4..e67c5ad 100644 --- a/client/lib/tests/RAID.tst +++ b/client/lib/tests/RAID.tst @@ -1,5 +1,5 @@ # NagCollect -- Nagios Data Collector for Passive Checks -# Copyright (c)2009-2010 Alexander Barton, alex@barton.de +# Copyright (c)2009-2011 Alexander Barton, alex@barton.de SERVICE="RAID_p" @@ -20,6 +20,31 @@ if [ `uname` = "Darwin" ]; then TEXT="OK - RAID status is good." fi fi + LC_ALL=C raidutil list status | grep "RAID " >"$tmp" + if [ $? -eq 0 ]; then + # Apple Hardware-RAID detected + declare -i good=0 + declare -i bad=0 + status="" + while read x; do + v=`echo "$x" | cut -d' ' -f1` + s=`echo "$x" | cut -b78-` + [ -n "$status" ] \ + && status="$status $v:$s" \ + || status="$v:$s" + [ "$s" = "Good" ] && good=$good+1 || bad=bad+1 + done <"$tmp" + if [ $bad -eq 0 -a $good -gt 1 ]; then + STATUS=0 + TEXT="OK - HW-RAID is good: $status" + elif [ $bad -gt 0 ]; then + STATUS=2 + TEXT="ERROR - HW-RAID status: $status" + else + STATUS=1 + TEXT="ERROR - HW-RAID status is unknown!? ($status)" + fi + fi rm -f "$tmp" elif [ `uname` = "Linux" -a -r /proc/mdstat ]; then status=$(cat /proc/mdstat | grep -E "(^md|^ [0-9])" | while read info1; do