X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=smart-megaraid.sh;h=76d7ed05e03ef22e3b22d6a96921ed4a671140aa;hb=6ae132b03f6ba35fe7e54446958f19df33058f4a;hp=3af5819e8cc1a5ce02de879cef8a1b5c2529a730;hpb=29e0fd3aa41503c060355d48e45706da6ac65b5f;p=gnt-info diff --git a/smart-megaraid.sh b/smart-megaraid.sh index 3af5819..76d7ed0 100755 --- a/smart-megaraid.sh +++ b/smart-megaraid.sh @@ -4,8 +4,8 @@ # smart-megaraid.sh '^# 1' # default without args # SMART="-t long" smart-megaraid.sh # execute smart command -pattern='^# 1' -test ! -z "$1" && pattern=$1 +pattern='(^# [1-2]|test remaining|Hours|Error|Serial|Model|Firmware|Load|Reallocated|Pending)' +test ! -z "$1" && pattern=$* did_megaraid=0 @@ -26,11 +26,9 @@ test -r /proc/mdstat && cat /proc/mdstat lsblk --noheadings --scsi -o name | while read drive ; do test ! -z "$SMART" && smartctl $SMART /dev/$drive > /dev/shm/smart.$drive-out smartctl -a /dev/$drive > /dev/shm/smart.$drive - if ! grep -q '^# 1' /dev/shm/smart.$drive ; then + if egrep -q '(PERC|MegaRaid|DELL)' /dev/shm/smart.$drive ; then megaraid $drive fi done -grep "$pattern" /dev/shm/smart.* | cut -d. -f2- | sed -e 's/:/\t/' - - +egrep -i "$pattern" /dev/shm/smart.* | grep -v -- '- *0$' | cut -d. -f2- | sed -e 's/:/\t/'