This guide is for debian squeeze
SMART is a nice mechanism to detect hard disc drive problems early. There is a daemon that sends user mails in order to notify you. But for normal desktops machines you usually don’t have your mail server set up properly so you can only receive local mails.
They can be read using the terminal command „mail“, but using your graphical user interface you won’t notice them in time.
Therefore I was searching for a way to send them to my normal account „firstname.lastname@example.org“. To make this happen, the local command
"echo "hello" | mail email@example.com -s 'testmail'" has to work.
I found some tutorials about how to set up exim 4 to use a smarthost to forward all mails to. But unfortunately this didn’t work with my provider arcor.de, they don’t seem to like it for spamming reasons. Luckily google has less of a problem with that, I guess they are just happy to be able to read the mails too …
I followed the great tutorial http://wiki.debian.org/GmailAndExim4 on how set up gmail as smarthost. Important was here to use my local (unofficial) domain
jet.bebop as it is configured on the local machine. This way exim can detect if the mail is supposed to go to localhost and does not involve google when just sending mail to „root“.
Testing after following the howto:
$ echo „Hello“ | mail firstname.lastname@example.org -s „Testing“
$ tail /var/log/exim4/mainlog
2011-02-13 14:03:35 1Pobbz-0003bM-E4 email@example.com R=smarthost T=remote_smtp_smarthost H=gmail-smtp-msa.l.google.com [22.214.171.124] X=TLS1.0:RSA_ARCFOUR_SHA1:16 DN=“C=US,ST=California,L=Mountain View,O=Google Inc,CN=smtp.gmail.com“
2011-02-13 14:03:38 1Pobbz-0003bM-E4 Completed
And I got mail.
Moving on to the second part, setting up smart, which is quite easy on debian.
I just installed
smartmontools and enabled the smartd in the default configs.
$ cat /etc/default/smartmontools
# Defaults for smartmontools initscript (/etc/init.d/smartmontools)
# This is a POSIX shell fragment
# List of devices you want to explicitly enable S.M.A.R.T. for
# Not needed (and not recommended) if the device is monitored by smartd
# uncomment to start smartd on system startup
# uncomment to pass additional options to smartd on startup
By default, smartd uses all drives in your system which is what I want. The config file is imho very verbose and can be modified to your needs. Important is to change the
-m firstname.lastname@example.org part to the desired mail address.
DEVICESCAN -d removable -n standby -m email@example.com -M exec /usr/share/smartmontools/smartd-runner
After reloading smart, everything should be set up and ready.
$ /etc/init.d/smartmontools reload
Reloading S.M.A.R.T. daemon: smartd.
But you can also test if the smart daemon can send mails to you by the following procedure just to sure:
Create a temporary config file just for the purpose of testing the mail delivery.
-M test will make the daemon send an initial test notification,
/dev/sdb can just be any drive on your system:
$ echo „/dev/sdb -m firstname.lastname@example.org -M test“ > /etc/smartd.conf.test
$ smartd -c /etc/smartd.conf.test
You should receive a mail like this:
This email was generated by the smartd daemon running on:
host name: jet
DNS domain: bebop
NIS domain: (none)
The following warning/error was logged by the smartd daemon:
TEST EMAIL from smartd for device: /dev/sdb [SAT]
For details see host’s SYSLOG (default: /var/log/syslog).
You can now kill that test daemon and sleep well with your smart monitored discs.