Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

Set up SMART Reporting via email

Ramboxman

Newbie
Joined
Jun 20, 2013
Messages
56
I just wanted to second this, "I haven't had a chance to implement this, but just wanted to say "Thank you" - this has to be one of the clearest, best written "how-to's". I appreciate you putting the time to document this clearly, including having a purpose at the top and step by step explanations of what it's doing. One of the things I struggle with as a newb is not knowing what I don't know.

I will give this a whirl!"

I just got this up and running sending me email through Cron in FreeNas 8.3.1 and I only had one little hiccup below in the setting for Cron issuing the command.

14) Use the following settings: (You may set the time intervals to whatever you desire)
User: root
Command: /etc/sh esmart.sh /dev/ada0 ***** For me I had to use this code Command: sh /etc/esmart.sh /dev/ada0*****
Description: ada0 SMART Results
Minute: Each selected minute: 01
Hour: Each selected hour: 01 (checking at 1 AM)
Day of month: Every N day of month: 1
Leave the rest at the default of all checked and click OK.
 

EvanVanVan

FreeNAS Experienced
Joined
Feb 1, 2014
Messages
170
I've been procrastinating doing this script since my question was kind of missed in a thread I posted, but is this information still valid? I mean does the latest FreeNAS do this without needing to create scripts myself? The last post on this thread was almost a year ago, so I'm just looking for some clarification. And as far as the latest FreeNas goes, which post should I follow, the OP or the information in #12? It seems like #12 is redundant in 9.2.1.4 since I've already set up similar stuff in the S.M.A.R.T. options under Services.

Thanks
 

EvanVanVan

FreeNAS Experienced
Joined
Feb 1, 2014
Messages
170
No response, but it looks like the post has been unstickied by some Admin/Mod in the past 24 hours, so I guess that in and of itself, is a response....
 

cyberjock

Moderator
Joined
Mar 25, 2012
Messages
19,148
Actually, I wrote a response, but I don't know why it's not here. I also don't know why its unstickied. This is the How-To section, so if we stickied everything you'd never see the other guides.

In short, FreeNAS does it's own monitoring. This email is to collect the SMART info and provide it to you every day(or whatever schedule you like). Its not a substitute for FreeNAS SMART testing OR monitoring. It's a supplement to it.
 
Joined
Mar 31, 2014
Messages
8
Thanks for the work that already has been done on this matter. I decided to adjust the way the emails are displayed by using monospaced fonts.
This link helped me with that. After playing around with sed ' x,y d' and sed 'x,y! d' I decided to grep everything I want from Smart-Info cause even identical types of HDs can have a different amount of lines been written out by smartctl. The resulting script is rather big, but it should work fine for all sorts of discs.

(If someone with more shell-knowledge than me can point out how to put the echoing for one disc in a single method, that'd be excellent! I don't like violating DRY so much. Might be ok for 4xHD systems, but not on 6+)

So here is my version of the script (for 4 HDs systems)
Code:
#!/usr/local/bin/sh
#
# Place this in /conf/base/etc/
# Call: sh esmart.sh
#
# Set idle mode to so it doesn't spin up.
# Options -n standby
# -i = Device Info
# -H = Device Health
# -A = Only Vendor specific SMART attributes
# -l error = SMART Error Log
# original command: 'smartctl -i -H -A -n standby -l error /dev/ada0'

(
echo "From: root@yourserver"
echo "To: <youremail>"
echo "Subject: SMART Drive Results for all <yourserver>-drives"
echo "MIME-Version: 1.0"
echo "Content-Type: text/html"
echo "Content-Disposition: inline"
echo "<html>"
echo "<body>"
echo '<pre style="font: monospace">'
smartctl | grep FreeBSD
smartctl | grep Copyright
echo " "
echo "### /dev/ada0 ###"
echo "=== START OF INFORMATION SECTION ==="
smartctl -i -H -A -l error /dev/ada0 > /var/smart
cat /var/smart | grep "Model Family"
cat /var/smart | grep "Device Model"
cat /var/smart | grep "Serial Number"
cat /var/smart | grep "User Capacity"
cat /var/smart | grep "SATA Version is"
echo " "
echo "=== START OF READ SMART DATA SECTION ==="
cat /var/smart | grep "SMART overall-health"
echo " "
cat /var/smart | grep "SMART Attributes Data Structure"
cat /var/smart | grep "Vendor Specific"
cat /var/smart | grep "ID#"
cat /var/smart | grep "Current_Pending_Sector"
cat /var/smart | grep "Reallocated_Sector_Ct"
cat /var/smart | grep "Offline_Uncorrectable"
cat /var/smart | grep "Raw_Read_Error_Rate"
cat /var/smart | grep "Seek_Error_Rate"
cat /var/smart | grep "Multi_Zone_Error_Rate"
cat /var/smart | grep "Temperature_Celsius"
cat /var/smart | grep "Power_On_Hours"
cat /var/smart | grep "Spin_Up_Time"
echo " "
echo " "
echo "### /dev/ada1 ###"
echo "=== START OF INFORMATION SECTION ==="
smartctl -i -H -A -l error /dev/ada1 > /var/smart
cat /var/smart | grep "Model Family"
cat /var/smart | grep "Device Model"
cat /var/smart | grep "Serial Number"
cat /var/smart | grep "User Capacity"
cat /var/smart | grep "SATA Version is"
echo " "
echo "=== START OF READ SMART DATA SECTION ==="
cat /var/smart | grep "SMART overall-health"
echo " "
cat /var/smart | grep "SMART Attributes Data Structure"
cat /var/smart | grep "Vendor Specific"
cat /var/smart | grep "ID#"
cat /var/smart | grep "Current_Pending_Sector"
cat /var/smart | grep "Reallocated_Sector_Ct"
cat /var/smart | grep "Offline_Uncorrectable"
cat /var/smart | grep "Raw_Read_Error_Rate"
cat /var/smart | grep "Seek_Error_Rate"
cat /var/smart | grep "Multi_Zone_Error_Rate"
cat /var/smart | grep "Temperature_Celsius"
cat /var/smart | grep "Power_On_Hours"
cat /var/smart | grep "Spin_Up_Time"
echo " "
echo " "
echo "### /dev/ada2 ###"
echo "=== START OF INFORMATION SECTION ==="
smartctl -i -H -A -l error /dev/ada2 > /var/smart
cat /var/smart | grep "Model Family"
cat /var/smart | grep "Device Model"
cat /var/smart | grep "Serial Number"
cat /var/smart | grep "User Capacity"
cat /var/smart | grep "SATA Version is"
echo " "
echo "=== START OF READ SMART DATA SECTION ==="
cat /var/smart | grep "SMART overall-health"
echo " "
cat /var/smart | grep "SMART Attributes Data Structure"
cat /var/smart | grep "Vendor Specific"
cat /var/smart | grep "ID#"
cat /var/smart | grep "Current_Pending_Sector"
cat /var/smart | grep "Reallocated_Sector_Ct"
cat /var/smart | grep "Offline_Uncorrectable"
cat /var/smart | grep "Raw_Read_Error_Rate"
cat /var/smart | grep "Seek_Error_Rate"
cat /var/smart | grep "Multi_Zone_Error_Rate"
cat /var/smart | grep "Temperature_Celsius"
cat /var/smart | grep "Power_On_Hours"
cat /var/smart | grep "Spin_Up_Time"
echo " "
echo " "
echo "### /dev/ada3 ###"
echo "=== START OF INFORMATION SECTION ==="
smartctl -i -H -A -l error /dev/ada3 > /var/smart
cat /var/smart | grep "Model Family"
cat /var/smart | grep "Device Model"
cat /var/smart | grep "Serial Number"
cat /var/smart | grep "User Capacity"
cat /var/smart | grep "SATA Version is"
echo " "
echo "=== START OF READ SMART DATA SECTION ==="
cat /var/smart | grep "SMART overall-health"
echo " "
cat /var/smart | grep "SMART Attributes Data Structure"
cat /var/smart | grep "Vendor Specific"
cat /var/smart | grep "ID#"
cat /var/smart | grep "Current_Pending_Sector"
cat /var/smart | grep "Reallocated_Sector_Ct"
cat /var/smart | grep "Offline_Uncorrectable"
cat /var/smart | grep "Raw_Read_Error_Rate"
cat /var/smart | grep "Seek_Error_Rate"
cat /var/smart | grep "Multi_Zone_Error_Rate"
cat /var/smart | grep "Temperature_Celsius"
cat /var/smart | grep "Power_On_Hours"
cat /var/smart | grep "Spin_Up_Time"
echo "</pre>"
echo "</body>"
echo "</html>"
) | sendmail -t
rm /var/smart
exit 0



Btw, I had 3 of my 4 2TB WD-Red RMAed one by one. Thank God I did Raid-Z2. I dunno whats wrong with WD at the moment. Maybe I got a monday-production or I should have ordered HDs from 4 different vendors. So if you wanna buy 4 HDs of a certain type, maybe buy them from different distributors with a month in between.
 

Attachments

Last edited:

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
8,258
Nice script and it looks like it works which is all that matters. The only improvement I can see would be to loop the duplicate commands but it's not like you have 20 drives to report.

One other thing you could do is a summary at the top in which you would evaluate all your failure values and add them up. Hopefully the end result would be a zero value and have that be the first thing you read in the email because going over a daily email all the time would become an issue. Having one location to look at would be a better answer, and possibly changing the subject line to add "ALERT" or something to bring your eye to it. But of course FreeNAS will report any errors it finds anyway. Sometimes it's fun playing with scripts, sometimes you're just happy it works. :cool:
 
Joined
Mar 31, 2014
Messages
8
Thanks Joe. Adding all the Smart attributes of all the drives (esp. the crucial counts) is actually a brilliant idea for a summary. Esp. when you have more than a handfull of discs to deal with.
 
Joined
Sep 15, 2014
Messages
8
Just thought I'd mention that Fox and I wrote a python script to automate the SMART reporting of disk temperatures via email. As it's currently written, it will send an email with the drive temps and will change the subject of the email appropriately when the drives are running too hot. It retrieves all info from the smartctl -a output, so other parameters could be added to the email report, or they could be stored in a database for easier tracking.

Current version of script here:
http://forums.freenas.org/index.php?threads/python-script-to-monitor-drive-temps.22794/#post-144657
 

thefox13

Newbie
Joined
Sep 15, 2014
Messages
20
Hey guys,
I followed Joe's procedure up to the cron job creation and when the cron job ran, it errored out saying /etc/sh: not found. Also the command 'mount -r/' wouldn't work for me running FreeNAS 9.3. Windows noob here but wondering if I have something simple messed up.
 

thefox13

Newbie
Joined
Sep 15, 2014
Messages
20
Haha, it was something simple. The command to put into the Cron job isn't '/etc/sh emsart.sh /dev/ada0' but 'sh /etc/esmart.sh /dev/ada0'.
 

tanik1

FreeNAS Experienced
Joined
Mar 31, 2013
Messages
163
hello, i upgraded to 9.3 and now my script for this smart test isn't working properly. this code was a combine of people here and it worked on an older version of freenas. But now when i run it for more than 3 drives it just hangs seems like its running but its not doing anything. But it works for 2 or less drives. I made some edits when seeing some more codes listed here to make sure it was correct.

Code:
#!/bin/sh

# check SMART drive status and mail results to given address

# parameters
email=checkthatshow@gmail.com
machine=freenas

# check usage
usage()
{
   echo 'Usage: sh smartmail.sh <drive0> [drive1 [drive2...driveN]]'
   echo 'where <driveN> is the name of a device in hpt,1/ , e.g. 1 2 3 4'
}

if [ $# -eq 0 ]
then
   usage
   exit 1
fi

# send summary report if more than 2 drives are involved
summarize=0
if [ $# -gt 2 ]
then
   summarize=1
fi

# specify process to check the drive
# -n standby  : skip if on standby (use 'never' to force a spinup)
# -H          : show overall health (must be included for summary!)
# -A          : show vendor-specific SMART attributes
# -l error    : show SMART error log
# -l selftest : show SMART test log
chkdrive()
{
   smartctl -H -A -l error -l selftest -d ${drivepath} /dev/hpt27xx >> ${logfile}
}

if [ ${summarize} -eq 1 ]
then
   logfile_summary=/mnt/temp/scripts/logs/smlog_summary
   # emit email header
   (
      echo "To: ${email}"
      echo "Subject: SMART Drive Status Summary for ${machine}"
      echo " "
      echo "SMART overall-health self-assessment test results"
   ) > ${logfile_summary}
fi

# iterate through all drives
for drive in "$@"
do
   drivepath=hpt,1/${drive}
   logfile=/mnt/temp/scripts/logs/smlog_${drive}

   # emit email header
   (
      echo "To: ${email}"
      echo "Subject: SMART Drive Status for ${machine}:${drivepath}"
      echo " "
   ) > ${logfile}

   sleepcount=0

   # check on the drive repeatedly until its awake
   chkdrive
   while [ $? != "0" ]
   do
      sleep 60
      sleepcount=`expr ${sleepcount} + 1`
      chkdrive
   done

   if [ ${sleepcount} -gt 0 ]
   then
      echo " "
      echo "DRIVE WAS ASLEEP FOR ROUGHLY ${sleepcount} MINUTES BEFORE STATUS WAS AVAILABLE" >> ${logfile}
   fi

   # extract summary line if desired
   if [ ${summarize} -eq 1 ]
   then
      status=`awk '/overall/' ${logfile} | cut -d: -f2`
      temp=`smartctl -a -d ${drivepath} /dev/hpt27xx | grep "194 Temperature" | cut -c5-24,37-40`
      SerNum=`smartctl -a -d ${drivepath} /dev/hpt27xx | awk '/Serial Number:/{print $0}' | awk '{print $3}'`
      echo -e "\n===${drivepath}===\n${SerNum}\n${temp}\n${status}" >> ${logfile_summary}
   fi

   # remove some gratuitous lines from the file
   sed -i '' -e '/Copyright/d' ${logfile}
   sed -i '' -e '/=== START/d' ${logfile}
done

#====CPU Temperatures======
echo -e "\n====Current CPU Temperatures====" >> ${logfile_summary}
sysctl -a |grep empe >> ${logfile_summary}


# send the summary first...
if [ ${summarize} -eq 1 ]
then
   sendmail -t < ${logfile_summary}
   rm ${logfile_summary}
fi
# ...then send individual drive status
for drive in "$@"
do
   logfile=/mnt/temp/scripts/logs/smlog_${drive}
   sendmail -t < ${logfile}
   rm ${logfile}
done

exit 0
 

Fraoch

FreeNAS Experienced
Joined
Aug 14, 2014
Messages
395
Also the command 'mount -r/' wouldn't work for me running FreeNAS 9.3.
Did you solve this one? It didn't work for me either:

Code:
mount: /: unknown special file or file system


and my esmart.sh file gets wiped out periodically.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
8,258
Off the cuff I'm not sure this will work for 9.3 just because there are many routine updates for this new flavor of FreeNAS.

So if you want to use this type of code, create a FreeBSD jail, open the shell for the jail, 'pkg_add-r smartmontools' and add your script. Skip steps 2 and 11 in my original posting.

This is a very quick posting as I have to run. Let me know if this works and I'll update the original posting to reflect 9.3 instructions.
 

angelus249

Newbie
Joined
Dec 19, 2014
Messages
28
Hi, Thanks for the script(s). Updated it to my needs. Works fine.

Just one question, which is slightly off-topic:
The script just gathers the SMART information and emails it and as cyberjock also mentioned earlier in this thread
In short, FreeNAS does it's own monitoring. This email is to collect the SMART info and provide it to you every day(or whatever schedule you like). Its not a substitute for FreeNAS SMART testing OR monitoring. It's a supplement to it.
What "FreeNAS own monitoring" is cyberjock referring to? Do I not even have to setup SMART tests myself? And if I have to, what kinda monitoring should I set up in the Tasks->S.M.A.R.T. Tests section?
What's the recommandation then of how often and which type (short/long self test) to run? I found kinda contradictory information (long once a month, short every day?!, others say long damages the disks, so rather not at all, etc.) and wild guessing, but no really usable information. I run 4x4TB in a RAID-Z1. Any recommandation or referral to another thread, if there is one, is much appreciated.

Cheers

EDIT:
In the services tab, SMART is enabled and set to a 30 minute interval, but no email defined. Should I do that? I'm a bit confused tbh
 
Last edited:

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
8,258
Hi, Thanks for the script(s). Updated it to my needs. Works fine.

Just one question, which is slightly off-topic:
The script just gathers the SMART information and emails it and as cyberjock also mentioned earlier in this thread


What "FreeNAS own monitoring" is cyberjock referring to? Do I not even have to setup SMART tests myself? And if I have to, what kinda monitoring should I set up in the Tasks->S.M.A.R.T. Tests section?
What's the recommandation then of how often and which type (short/long self test) to run? I found kinda contradictory information (long once a month, short every day?!, others say long damages the disks, so rather not at all, etc.) and wild guessing, but no really usable information. I run 4x4TB in a RAID-Z1. Any recommandation or referral to another thread, if there is one, is much appreciated.

Cheers

EDIT:
In the services tab, SMART is enabled and set to a 30 minute interval, but no email defined. Should I do that? I'm a bit confused tbh
FreeNAS only reports when there is a failure, not if things went okay and that is the reason for the script. Back when I created this thread (note the date) there were some issues with reporting and we all wanted to know if things passed for sure and some folks are use to getting those emails so they still use a script.

If you are not using a script then in FreeNAS you should setup the email notifications and establish routine SMART Short and Long Tests. The frequency you conduct these tests are up to you but I prefer to do daily Short tests (Mon-Sat) and a weekly Long test (Sun) on all my drives at the same time. I start mine at 5AM because I prefer that time and it doesn't conflict with my automated backups.
 

angelus249

Newbie
Joined
Dec 19, 2014
Messages
28
Thanks, that clears things up.
 

SkyMonkey

FreeNAS Experienced
Joined
Mar 13, 2013
Messages
102
You should no longer use these commands, please see next post.

Disregard the below.
------------------------------------
So I've been using a variation of this script for a few years now, and just upgraded to 9.3. Copying all my scripts files back I had the same issue remounting the file system as ro as below.

Did you solve this one? It didn't work for me either:

Code:
mount: /: unknown special file or file system


and my esmart.sh file gets wiped out periodically.
I'm no expert in FreeBSD command lines, but reading the man page and trying a few different things seems to indicate that the following command is equivalent, and at least does not produce the above error on my machine.

Code:
mount -r -o ro /


Not 100% sure, but it seems to have worked for the moment. No idea why this changed but again, totally not an expert here...
 
Last edited:

nick779

FreeNAS Experienced
Joined
Dec 17, 2014
Messages
188
Maybe I missed it somewhere in thread, but is it possible to add the smart test data to the script?

Im using this one
Code:
#!/usr/local/bin/sh
#
# Place this in /conf/base/etc/
# Call: sh esmart.sh
#
# Set idle mode to so it doesn't spin up.
# Options -n standby
# -i = Device Info
# -H = Device Health
# -A = Only Vendor specific SMART attributes
# -l error = SMART Error Log
# original command: 'smartctl -i -H -A -n standby -l error /dev/ada0'

(
echo "From: root@HomeNAS"
echo "To: NickNAS779@gmail.com"
echo "Subject: SMART Drive Results for all HomeNAS-drives"
echo "MIME-Version: 1.0"
echo "Content-Type: text/html"
echo "Content-Disposition: inline"
echo "<html>"
echo "<body>"
echo '<pre style="font: monospace">'
smartctl | grep FreeBSD
smartctl | grep Copyright
echo " "
echo "### /dev/ada0 ###"
echo "=== START OF INFORMATION SECTION ==="
smartctl -i -H -A -l error /dev/ada0 > /var/smart
cat /var/smart | grep "Model Family"
cat /var/smart | grep "Device Model"
cat /var/smart | grep "Serial Number"
cat /var/smart | grep "User Capacity"
cat /var/smart | grep "SATA Version is"
echo " "
echo "=== START OF READ SMART DATA SECTION ==="
cat /var/smart | grep "SMART overall-health"
echo " "
cat /var/smart | grep "SMART Attributes Data Structure"
cat /var/smart | grep "Vendor Specific"
cat /var/smart | grep "ID#"
cat /var/smart | grep "Current_Pending_Sector"
cat /var/smart | grep "Reallocated_Sector_Ct"
cat /var/smart | grep "Offline_Uncorrectable"
cat /var/smart | grep "Raw_Read_Error_Rate"
cat /var/smart | grep "Seek_Error_Rate"
cat /var/smart | grep "Multi_Zone_Error_Rate"
cat /var/smart | grep "Temperature_Celsius"
cat /var/smart | grep "Power_On_Hours"
cat /var/smart | grep "Spin_Up_Time"
echo " "
echo " "
echo "### /dev/ada1 ###"
echo "=== START OF INFORMATION SECTION ==="
smartctl -i -H -A -l error /dev/ada1 > /var/smart
cat /var/smart | grep "Model Family"
cat /var/smart | grep "Device Model"
cat /var/smart | grep "Serial Number"
cat /var/smart | grep "User Capacity"
cat /var/smart | grep "SATA Version is"
echo " "
echo "=== START OF READ SMART DATA SECTION ==="
cat /var/smart | grep "SMART overall-health"
echo " "
cat /var/smart | grep "SMART Attributes Data Structure"
cat /var/smart | grep "Vendor Specific"
cat /var/smart | grep "ID#"
cat /var/smart | grep "Current_Pending_Sector"
cat /var/smart | grep "Reallocated_Sector_Ct"
cat /var/smart | grep "Offline_Uncorrectable"
cat /var/smart | grep "Raw_Read_Error_Rate"
cat /var/smart | grep "Seek_Error_Rate"
cat /var/smart | grep "Multi_Zone_Error_Rate"
cat /var/smart | grep "Temperature_Celsius"
cat /var/smart | grep "Power_On_Hours"
cat /var/smart | grep "Spin_Up_Time"
echo " "
echo " "
echo "### /dev/ada2 ###"
echo "=== START OF INFORMATION SECTION ==="
smartctl -i -H -A -l error /dev/ada2 > /var/smart
cat /var/smart | grep "Model Family"
cat /var/smart | grep "Device Model"
cat /var/smart | grep "Serial Number"
cat /var/smart | grep "User Capacity"
cat /var/smart | grep "SATA Version is"
echo " "
echo "=== START OF READ SMART DATA SECTION ==="
cat /var/smart | grep "SMART overall-health"
echo " "
cat /var/smart | grep "SMART Attributes Data Structure"
cat /var/smart | grep "Vendor Specific"
cat /var/smart | grep "ID#"
cat /var/smart | grep "Current_Pending_Sector"
cat /var/smart | grep "Reallocated_Sector_Ct"
cat /var/smart | grep "Offline_Uncorrectable"
cat /var/smart | grep "Raw_Read_Error_Rate"
cat /var/smart | grep "Seek_Error_Rate"
cat /var/smart | grep "Multi_Zone_Error_Rate"
cat /var/smart | grep "Temperature_Celsius"
cat /var/smart | grep "Power_On_Hours"
cat /var/smart | grep "Spin_Up_Time"
echo " "
echo " "
echo "### /dev/ada3 ###"
echo "=== START OF INFORMATION SECTION ==="
smartctl -i -H -A -l error /dev/ada3 > /var/smart
cat /var/smart | grep "Model Family"
cat /var/smart | grep "Device Model"
cat /var/smart | grep "Serial Number"
cat /var/smart | grep "User Capacity"
cat /var/smart | grep "SATA Version is"
echo " "
echo "=== START OF READ SMART DATA SECTION ==="
cat /var/smart | grep "SMART overall-health"
echo " "
cat /var/smart | grep "SMART Attributes Data Structure"
cat /var/smart | grep "Offline_Uncorrectable"
cat /var/smart | grep "Raw_Read_Error_Rate"
cat /var/smart | grep "Seek_Error_Rate"
cat /var/smart | grep "Multi_Zone_Error_Rate"
cat /var/smart | grep "Temperature_Celsius"
cat /var/smart | grep "Power_On_Hours"
cat /var/smart | grep "Spin_Up_Time"
echo " "
echo " "
echo "### /dev/ada3 ###"
echo "=== START OF INFORMATION SECTION ==="
smartctl -i -H -A -l error /dev/ada3 > /var/smart
cat /var/smart | grep "Model Family"
cat /var/smart | grep "Device Model"
cat /var/smart | grep "Serial Number"
cat /var/smart | grep "User Capacity"
cat /var/smart | grep "SATA Version is"
echo " "
echo "=== START OF READ SMART DATA SECTION ==="
cat /var/smart | grep "SMART overall-health"
echo " "
cat /var/smart | grep "SMART Attributes Data Structure"
cat /var/smart | grep "Vendor Specific"
cat /var/smart | grep "ID#"
cat /var/smart | grep "Current_Pending_Sector"
cat /var/smart | grep "Reallocated_Sector_Ct"
cat /var/smart | grep "Offline_Uncorrectable"
cat /var/smart | grep "Raw_Read_Error_Rate"
cat /var/smart | grep "Seek_Error_Rate"
cat /var/smart | grep "Multi_Zone_Error_Rate"
cat /var/smart | grep "Temperature_Celsius"
cat /var/smart | grep "Power_On_Hours"
cat /var/smart | grep "Spin_Up_Time"
echo "</pre>"
echo "</body>"
echo "</html>"
) | sendmail -t
rm /var/smart
exit 0
 

DifferentStrokes

FreeNAS Experienced
Joined
Jan 9, 2015
Messages
428
Maybe I missed it somewhere in thread, but is it possible to add the smart test data to the script?

Im using this one
Code:
...
echo "### /dev/ada3 ###"
echo "=== START OF INFORMATION SECTION ==="
smartctl -i -H -A -l error /dev/ada3 > /var/smart
...
echo "### /dev/ada3 ###"
echo "=== START OF INFORMATION SECTION ==="
smartctl -i -H -A -l error /dev/ada3 > /var/smart
....
) | sendmail -t
rm /var/smart
exit 0
Something I just happened to notice. Are you checking ada3 twice by accident or do you have an ada4 that is getting messed?
 
Top