]> arthur.barton.de Git - nagcollect.git/commitdiff
Test Linux software RAID (md devices)
authorAlexander Barton <alex@barton.de>
Wed, 13 Jan 2010 21:42:17 +0000 (22:42 +0100)
committerAlexander Barton <alex@barton.de>
Wed, 13 Jan 2010 21:42:17 +0000 (22:42 +0100)
client/lib/tests/RAID.tst

index 7a8c586a7d0aeb745be90cdf14962f64d2362bef..d536e121a56034626cad2f8aa1e1a6334504e4a0 100644 (file)
@@ -19,4 +19,18 @@ if [ `uname` = "Darwin" ]; then
                fi
        fi
        rm -f "$tmp"
+elif [ `uname` = "Linux" ]; then
+       status=$(cat /proc/mdstat | grep -E "(^md|^      [0-9])" | while read info1; do
+               read info2
+               dev=`echo $info1 | cut -d' ' -f1`
+               stat=`echo $info2 | cut -d'[' -f 3 | cut -d']' -f1`
+               echo -n " $dev:$stat"
+       done)
+       if [ "`echo $status | tr -d 'md0123456789: U'`" = "" ]; then
+               STATUS=0
+               TEXT="OK - RAID is good: $status"
+       else
+               STATUS=2
+               TEXT="ERROR - RAID status: $status"
+       fi
 fi