I figured I'd post my version since it is different. I am using an Areca RAID controller so I have to get my SMART information from the areca-cli utility included with FreeNAS. Credit to joeschmuck for providing his script from which my script is based on.
I execute a modified esmart.sh(tweaked slightly to make me happy) and call the areca-cli and feed it the necessary commands to get data from all 24 ports. If a port is empty it will reply with an error but will continue to the next port. That way I don't have to keep changing the script if I add/remove/move drives. I also keep my data on the zpool just in case I want it someday.
I have 2 major 'feature' additions for me though:
1. I create a file with the SMART data for all of the drives and then
grep Pending to get a printout of just the lines with Current Pending Sector count. Now when I get the email instead of going through 47kbytes of email I can look at the first 28 lines(4 drives on my onboard Intel controller plus 24 from Areca). If they are all zeros then I know things are doing good. Current Pending Sector count is not an end-all-be-all for failing disks, but it is a very good indicator. I had to do this because the areca-cli does not allow for a printout of just the error log for the hard drives.
2. I also
grep Temperature to get a printout of all of the drive temps. The areca-cli returns the temps in Fahrenheit even though it says C. I just have to ignore the C and realize that the drives aren't 115C but 115F. :)
Code:
rm /mnt/tank/.SMARTdata/`date +%Y%m%d`
rm /mnt/tank/.SMARTdata/`date +%Y%m%d`b
(
echo "To: ***youremail@goeshere.com***"
echo "Subject: SMART Drive Results for hard drives in ***yourservernamehere***"
echo " "
echo "The following lists the Current Pending Sector Count for all hard drives on the system in order:"
echo " "
) > /mnt/tank/.SMARTdata/`date +%Y%m%d`
smartctl -a /dev/ada0 >> /mnt/tank/.SMARTdata/`date +%Y%m%d`b
smartctl -a /dev/ada1 >> /mnt/tank/.SMARTdata/`date +%Y%m%d`b
smartctl -a /dev/ada2 >> /mnt/tank/.SMARTdata/`date +%Y%m%d`b
smartctl -a /dev/ada3 >> /mnt/tank/.SMARTdata/`date +%Y%m%d`b
areca-cli < /mnt/tank/.SMARTdata/areca >> /mnt/tank/.SMARTdata/`date +%Y%m%d`b
cat /mnt/tank/.SMARTdata/`date +%Y%m%d`b | grep Pending >> /mnt/tank/.SMARTdata/`date +%Y%m%d`
echo " " >> /mnt/tank/.SMARTdata/`date +%Y%m%d`
echo "The following lists the current temperatures for all hard drives on the system in order:" >> /mnt/tank/.SMARTdata/`date +%Y%m%d`
echo " " >> /mnt/tank/.SMARTdata/`date +%Y%m%d`
cat /mnt/tank/.SMARTdata/`date +%Y%m%d`b | grep "194 Temperature" >> /mnt/tank/.SMARTdata/`date +%Y%m%d`
echo " " >> /mnt/tank/.SMARTdata/`date +%Y%m%d`
echo "The following is the long printout of all SMART data for all hard drives on the system in order:" >> /mnt/tank/.SMARTdata/`date +%Y%m%d`
echo " " >> /mnt/tank/.SMARTdata/`date +%Y%m%d`
cat /mnt/tank/.SMARTdata/`date +%Y%m%d`b >> /mnt/tank/.SMARTdata/`date +%Y%m%d`
rm /mnt/tank/.SMARTdata/`date +%Y%m%d`b
sendmail -t < /mnt/tank/.SMARTdata/`date +%Y%m%d`
exit 0
My /mnt/tank/.SMARTdata/areca (the commands that are run inside the areca-cli) are:
Code:
set password=***yourRAIDcontrollerpasswordhere***
disk info drv=1
disk smart drv=1
disk info drv=2
disk smart drv=2
disk info drv=3
disk smart drv=3
disk info drv=4
disk smart drv=4
disk info drv=5
disk smart drv=5
disk info drv=6
disk smart drv=6
disk info drv=7
disk smart drv=7
disk info drv=8
disk smart drv=8
disk info drv=9
disk smart drv=9
disk info drv=10
disk smart drv=10
disk info drv=11
disk smart drv=11
disk info drv=12
disk smart drv=12
disk info drv=13
disk smart drv=13
disk info drv=14
disk smart drv=14
disk info drv=15
disk smart drv=15
disk info drv=16
disk smart drv=16
disk info drv=17
disk smart drv=17
disk info drv=18
disk smart drv=18
disk info drv=19
disk smart drv=19
disk info drv=20
disk smart drv=20
disk info drv=21
disk smart drv=21
disk info drv=22
disk smart drv=22
disk info drv=23
disk smart drv=23
disk info drv=24
disk smart drv=24
hw info
exit
The email I get looks like this:
Code:
The following lists the Current Pending Sector Count for all hard drives on the system in order:
197 Current_Pending_Sector 0x0032 200 200 000 Old_age Always - 0
197 Current_Pending_Sector 0x0032 200 200 000 Old_age Always - 0
197 Current_Pending_Sector 0x0032 200 200 000 Old_age Always - 0
197 Current_Pending_Sector 0x0032 200 200 000 Old_age Always - 0
197 Current Pending Sector Count 0x32 200 0 OK
197 Current Pending Sector Count 0x32 200 0 OK
197 Current Pending Sector Count 0x32 200 0 OK
197 Current Pending Sector Count 0x32 200 0 OK
197 Current Pending Sector Count 0x32 200 0 OK
197 Current Pending Sector Count 0x32 200 0 OK
197 Current Pending Sector Count 0x32 200 0 OK
197 Current Pending Sector Count 0x32 200 0 OK
197 Current Pending Sector Count 0x32 200 0 OK
197 Current Pending Sector Count 0x32 200 0 OK
197 Current Pending Sector Count 0x32 200 0 OK
197 Current Pending Sector Count 0x32 200 0 OK
197 Current Pending Sector Count 0x32 200 0 OK
197 Current Pending Sector Count 0x32 200 0 OK
The following lists the current temperatures for all hard drives on the system in order:
194 Temperature_Celsius 0x0022 113 103 000 Old_age Always - 39
194 Temperature_Celsius 0x0022 112 102 000 Old_age Always - 40
194 Temperature_Celsius 0x0022 114 102 000 Old_age Always - 38
194 Temperature_Celsius 0x0022 113 101 000 Old_age Always - 39
194 Temperature 0x22 111 0 OK
194 Temperature 0x22 110 0 OK
194 Temperature 0x22 111 0 OK
194 Temperature 0x22 112 0 OK
194 Temperature 0x22 111 0 OK
194 Temperature 0x22 111 0 OK
194 Temperature 0x22 110 0 OK
194 Temperature 0x22 112 0 OK
194 Temperature 0x22 113 0 OK
194 Temperature 0x22 111 0 OK
194 Temperature 0x22 113 0 OK
194 Temperature 0x22 115 0 OK
194 Temperature 0x22 115 0 OK
194 Temperature 0x22 115 0 OK
The following is the long printout of all SMART data for all hard drives on the system in order:
Then a complete printout of all of the drive SMART info is attached so I can match the bad temp/pending sector count to the /dev and serial number.