grep smart logs for failure and running smart tests
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 1 Oct 2011 10:55:27 +0000 (10:55 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 1 Oct 2011 10:55:27 +0000 (10:55 +0000)
git-svn-id: svn://svn.rot13.org/sysadmin-cookbook@280 191e9f34-6774-4a6d-acfc-7664dacd4a2a

recepies/smart/failure.sh [new file with mode: 0755]

diff --git a/recepies/smart/failure.sh b/recepies/smart/failure.sh
new file mode 100755 (executable)
index 0000000..dbd9c6e
--- /dev/null
@@ -0,0 +1,5 @@
+sed='s!/smart.! !'
+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
+       echo $host $serial $status $count
+       egrep -A 1 '(failure|progress)' $host/smart.*$serial | sed -e "$sed"
+done