From: Alexander Barton Date: Tue, 17 Jan 2012 10:40:03 +0000 (+0100) Subject: RAID.tst (Linux): don't report empty status when no RAID exists X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=nagcollect.git;a=commitdiff_plain;h=b29552015c28f4742f715989ee498876ce621992 RAID.tst (Linux): don't report empty status when no RAID exists --- diff --git a/client/lib/tests/RAID.tst b/client/lib/tests/RAID.tst index d814588..048d45b 100644 --- a/client/lib/tests/RAID.tst +++ b/client/lib/tests/RAID.tst @@ -48,17 +48,20 @@ if [ `uname` = "Darwin" ]; then 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 + 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" + if [ -n "$status" ]; then + 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 fi