Monitor hard disk health status with smartd on Linux ·
another meaningless subtitle

Monitor hard disk health status with smartd on Linux

· by fabio · Read in about 2 min · (241 Words)
CentOS fedora Gentoo linux nullmailer SMART smartctl smartd

## This does not really works, read this: ##

First of all install smartmontools, it has the same name on pretty much every distro:

$ emerge -a1 smartmontools

Proceed to edit its configuration file, at the bottom of the file there is a quick explaination of all the available parameters:

DEVICESCAN -H -R 1 -R 5 -R 7 -R 10 -R 11 -R 196 -R 197 -R 199 -R 200 -m user@domain.tld -n standby,10,q

Parameter “-H” tells smartd to check the result of “overall-health self-assesment test” which is pretty much useless, “-R” is used to specify a single SMART attribute, if its value changes a mail is sent to user@domain.tld.
To send emails a MTA must be installed, in centos that is sendmail, in gentoo it is not strictly necessary to have a full fledget MTA installed, nullmailer will suffice.
If it is not already installed:

$ emerge -a1 nullmailer
$ emerge --config nullmailer


mailserver smtp starttls insecure

This will work only if nullmail can rely on an actual mail server to send the messages for him, in case this is not possible or not practical I would just install sendmail and call it a day.
Enable nullmailer service:

$ rc-update add nullmailer default
$ service nullmailer restart

To the smartd add “-M test” at the end of DEVICESCAN line and then restart smartd service.
Smartd should send an email every time one of the selected SMART attribues changes.