X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=smart-megaraid.sh;h=88f7d44dce25966c47b07c0938ab6e09aeecf5fe;hb=37225465cf437e144c0f896cec72fdd8e26540d2;hp=5f158916694039e71f1f0d6e2824b2d15c20d52b;hpb=2ce716dba8b471323cb71778aa8e6a220ea31b80;p=gnt-info diff --git a/smart-megaraid.sh b/smart-megaraid.sh index 5f15891..88f7d44 100755 --- a/smart-megaraid.sh +++ b/smart-megaraid.sh @@ -4,7 +4,7 @@ # smart-megaraid.sh '^# 1' # default without args # SMART="-t long" smart-megaraid.sh # execute smart command -pattern='(^# [1-2]|test remaining|Hours|Error|Serial|Model|Firmware)' +pattern='(^# [1-2]|test remaining|Hours|Error|Serial|Model|Firmware|Load|Reallocated|Pending|failure)' test ! -z "$1" && pattern=$* did_megaraid=0 @@ -26,9 +26,13 @@ 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 + rm /dev/shm/smart.$drive fi done -egrep "$pattern" /dev/shm/smart.* | grep -v -- '- *0$' | cut -d. -f2- | sed -e 's/:/\t/' +grep 'Serial Number' /dev/shm/smart.sd* | cut -d: -f3| sort | uniq -c | grep -v ' 1 ' | awk '{ print $2 }' > /dev/shm/smart.duplicate && \ + grep -l -f /dev/shm/smart.duplicate /dev/shm/smart.sd? | xargs -i rm -v {} + +egrep -i "$pattern" /dev/shm/smart.* | grep -v -- '- *0$' | cut -d. -f2- | sed -e 's/:/\t/'