Allow Smartmontools to send emails via Gmail, using exim

Allow Smartmontools to relay mail via Gmail utilising the robust lightweight Exim mail transfer agent.

Install exim:

apt-get install exim4-base exim4-config
apt-get install exim4

configure Exim

dpkg-reconfigure exim4-config

Exim configuration:










Edit your credentials:

john@mylocalmachine:/home/john# cat /etc/exim4/passwd.client
# password file used when the local exim is authenticating to a remote
# host as a client.
# see exim4_passwd_client(5) for more documentation
# Example:
### target.mail.server.example:login:password

Secure your credentials:

chmod 640 /etc/exim4/passwd.client

This two step process ensures Exim4’s configuration is updated and the deamon is restarted:

invoke-rc.d exim4 restart

Benign error starting exim, on my system:

ALERT: exim paniclog /var/log/exim4/paniclog has non-zero size, mail system possibly broken
rm /var/log/exim4/paniclog

Confirm that Exim is operational via:

echo testing | mail -s Bla

Checking that smart monitoring is enabled at boot (on Debian based systems):



Installing the below mailutils will allow the smartd daemon to send emails via exim (configured for gmail relay) :

apt-get install mailutils

Adjust your Smartmontools configuration so it sends out an email on start up and when a problem is encountered with one of your disks.

# cat /etc/smartd.conf
/dev/sg1 -a -d sat -o on -S on -s (S/../.././02|L/../../6/03) -m -M exec /usr/share/smartmontools/smartd-runner
/dev/sg2 -a -d sat -o on -S on -s (S/../.././02|L/../../6/03) -m -M exec /usr/share/smartmontools/smartd-runner
/dev/sg3 -a -d sat -o on -S on -s (S/../.././02|L/../../6/03) -m -M exec /usr/share/smartmontools/smartd-runner
/dev/sg4 -a -d sat -o on -S on -s (S/../.././02|L/../../6/03) -m -M exec /usr/share/smartmontools/smartd-runner
/dev/sg4 -H -m -M test

You will need the below line to send out a test email on smartd start up.

/dev/sg4 -H -m -M test

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s