S.M.A.R.T Monitoring and Email Notification Ubuntu 14.04

Ubuntu Linux Specific Guides
Post Reply
User avatar
dedwards
Site Admin
Posts: 70
Joined: Wed Mar 15, 2006 8:28 pm
Contact:

S.M.A.R.T Monitoring and Email Notification Ubuntu 14.04

Post by dedwards » Thu Oct 14, 2010 3:03 pm

1. Install smartmontools and smart-notifier and accept all dependencies:

Code: Select all

sudo apt-get install smartmontools


2. Enable smart features on each drive. First list all the drives with:

Code: Select all

df


If the drives are part of a linux software raid array issue this command first:

Code: Select all

mdadm –detail /dev/md0


Assuming your array is /dev/md0 or it could be any number you set. Adjust as necessary. After you get a listing of all the drives you want to monitor enter the following command for each drive:

Code: Select all

smartctl --smart=on --offlineauto=on --saveauto=on /dev/sdb


This assumes there’s drive /dev/sdb that you want to enable smart status on it. You can check the smart status for each drive you enabled smart status on by using this command:

Code: Select all

smartctl --all /dev/sdb


4. Edit your /etc/smartd.conf file:

Code: Select all

sudo vi /etc/smartd.conf


Replace the "root" entry right after the "-m" with the email address that you want the notifications to go on the "DEVICESCAN" line:

Code: Select all

DEVICESCAN -m email_notify@yourdomain.com -M exec /usr/share/smartmontools/smartd-runner


5. Configure smartd to start automatically. Edit the "/etc/default/smartmontools" file:

Code: Select all

sudo vi /etc/default/smartmontools


Uncomment the "start_smartd=yes" line and save the file.

Restart smartmontools:

Code: Select all

sudo /etc/init.d/smartmontools restart
* Restarting S.M.A.R.T. daemon smartd                                   [ OK ]


Ensure service is running:

Code: Select all

ps -A|grep "smart"


You should get a result similar to below:

Code: Select all

1700 ?        00:00:00 smartd


If the service fails to start, check out /var/log/messages for any errors and correct them. It's also a good idea to reboot your machine and verifying that the "smartd" service started automatically.

6. Next test to make sure e-mail notifications for S.M.A.R.T errors work. Edit /etc/smartd.conf file:

Code: Select all

sudo vi /etc/smartd.conf


at the end of the DEVICESCAN line enter -M test so it looks similar to below:

Code: Select all

DEVICESCAN -m email_notify@yourdomain.com -M exec /usr/share/smartmontools/smartd-runner -M test


Save the file and restart smartmontools:

Code: Select all

sudo /etc/init.d/smartmontools restart
* Restarting S.M.A.R.T. daemon smartd                                   [ OK ]


Once you receive the notification, edit the /etc/smartd.conf file and remove the -M test part, save the file and restart smartmontools.

7. Next, take an inventory of all your drives serial numbers, drive types etc. so that in case of failure you can quickly identify the affected drive. Run the following command for each of one of your monitored drives:

Code: Select all

smartctl -i /dev/sdb


you will get a result similar to below:

Code: Select all

=== START OF INFORMATION SECTION ===
Device Model:     WDC WD40EFRX-68WT0N0
Serial Number:    WD-WCC4E1VUAYCJ
LU WWN Device Id: 5 0014ee 2b66e8190
Firmware Version: 82.00A82
User Capacity:    4,000,787,030,016 bytes [4.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5400 rpm
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ACS-2 (minor revision not indicated)
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Thu Apr 28 07:54:26 2016 EDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled


Save the output of each drive in a safe place for future reference if necessary
Post Reply