X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=smart-megaraid.sh;h=1e976f4f86a4e1328bb788ec3835fb3258a6bfe1;hb=32ca0f53c630e84193b4fd0c88b415f93e1f32e0;hp=3af5819e8cc1a5ce02de879cef8a1b5c2529a730;hpb=29e0fd3aa41503c060355d48e45706da6ac65b5f;p=gnt-info diff --git a/smart-megaraid.sh b/smart-megaraid.sh index 3af5819..1e976f4 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)' +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 "$pattern" /dev/shm/smart.* | grep -v -- '- *0$' | cut -d. -f2- | sed -e 's/:/\t/'