New "RAID" test to check Apple Software-RAIDs
authorAlexander Barton <alex@barton.de>
Mon, 14 Dec 2009 13:12:20 +0000 (14:12 +0100)
committerAlexander Barton <alex@barton.de>
Mon, 14 Dec 2009 13:12:20 +0000 (14:12 +0100)
client/lib/tests/RAID.tst [new file with mode: 0644]

diff --git a/client/lib/tests/RAID.tst b/client/lib/tests/RAID.tst
new file mode 100644 (file)
index 0000000..9c6b59d
--- /dev/null
@@ -0,0 +1,22 @@
+# NagCollect -- Nagios Data Collector for Passive Checks
+# Copyright (c)2009 Alexander Barton, alex@barton.de
+
+SERVICE="RAID_p"
+
+if [ `uname` = "Darwin" ]; then
+       tmp=`mktemp "/tmp/$$.XXXX"`
+       LC_ALL=C diskutil checkRAID >"$tmp"
+       if [ $? -eq 0 ]; then
+               # Apple Software-RAID detected
+               statusText=`grep "^Status:" "$tmp"`
+               status=`echo "$statusText" | cut -d' ' -f2-`
+               if [ "$status" != "Online" ]; then
+                       STATUS=2
+                       TEXT="ERROR - RAID is $status"
+               else
+                       STATUS=0
+                       TEXT="OK - RAID status is good."
+               fi
+       fi
+       rm -f "$tmp"
+fi