better output while relocating sectors
[sysadmin-cookbook] / recepies / smart / failure.sh
1 sed='s!/smart.! !'
2 egrep '(Raw_Read_Error_Rate|Reallocated_Sector_Ct|Seek_Error_Rate|Spin_Retry_Count|Reallocated_Event_Count|Current_Pending_Sector|Offline_Uncorrectable|UDMA_CRC_Error_Count)' */smart.* | awk '{ if ( $10 > 0 ) print $1 " " $2 " " $10 }' | sed -e "$sed" -e 's/:[0-9][0-9]* / /' | sort | while read host serial status count ; do
3         echo $host $serial $status $count
4         egrep -A 1 '(failure|progress)' $host/smart.*$serial | sed -e "$sed"
5 done