maintence.sh 2.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. DATE=$2
  3. IP=$1
  4. logfile="/root/log/Disk_Status-$1-$DATE.log"
  5. tempFile="/tmp/smart-raid-zfs-$1_$DATE.log"
  6. echo "Do disk chek waiting for connection whit:$IP @ `date`______________________________________________________________________________________________________________________________"
  7. echo "-----------------------------------------------------------------------------------------------`date` chacke mdraid devices" >> $tempFile
  8. ssh root@$IP -tti /home/thierry/id_rsa 'cat /proc/mdstat' >> $tempFile
  9. echo "-----------------------------------------------------------------------------------------------`date` zfs pool" >> $tempFile
  10. ssh root@$IP -tti /home/thierry/id_rsa 'zpool status' >> $tempFile
  11. echo "-----------------------------------------------------------------------------------------------`date` Smart inportend Valus" >> $tempFile
  12. ssh root@$IP -tti /home/thierry/id_rsa 'echo " "; echo " "; echo " "; date;echo "--------------------------------------------------------------------------------------------------------------"; smartctl --all /dev/sda ;smartctl --all /dev/sdb ; smartctl --all /dev/sdc ; smartctl --all /dev/sdd ; smartctl --all /dev/sde; smartctl --all /dev/sdf ; smartctl --all -d sat /dev/sdg' >> $tempFile.tmp ###smartd test on al disk manual setup
  13. echo "next valuas are in order of sda sdb sdc sdd sde and ordererd by error" >> $tempFile
  14. echo "ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE" >> $tempFile
  15. grep -E 'Raw_Read_Error_Rate' $tempFile.tmp >> $tempFile
  16. grep -E 'Reallocated_Sector_Ct' $tempFile.tmp >> $tempFile
  17. grep -E 'Seek_Error_Rate' $tempFile.tmp >> $tempFile
  18. grep -E 'Power_On_Hours' $tempFile.tmp >> $tempFile
  19. grep -E 'Load_Cycle_Count' $tempFile.tmp >> $tempFile
  20. grep -E 'Reallocated_Event_Count' $tempFile.tmp >> $tempFile
  21. grep -E 'Media_Wearout_Indicator' $tempFile.tmp >> $tempFile
  22. scp -i /home/thierry/id_rsa $tempFile root@10.0.0.1:$logfile #work around for remote machines? workaround dont touch!
  23. rm $tempFile
  24. echo "Done disk chek waiting for connection whit:$IP @ `date`______________________________________________________________________________________________________________________________"
  25. #use hdparm -i /dev/sd[abcd] to indentify disk....serial number etc...