Retrospective IT

Setup sSMTP for Nagios Alerts

Nagios sSMTP on Ubuntu 16.04

sSMTP is a simple, lightweight SMTP delivery agent. Its easy to setup and works great with Nagios. I will document the steps I used to get it working for my Nagios server.

sSMTP is available in the Ubuntu repos and can be installed with the following command:

apt install ssmtp

Once sSMTP is installed, we’ll need to edit main config file and set it to relay to our mail server. I currently use SendGrid since it is external and reliable. Adjust your settings as needed.

nano /etc/ssmtp/ssmtp.conf

# Config file for sSMTP sendmail
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
[email protected]

# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named


# Where will the mail seem to come from?

# The full hostname

# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address

Now you can test sSMTP and verify you're able to receive emails

echo "Hello, World" | mail -s "sSMTP Nagios Email Test" [email protected]

Now we'll need to change /usr/local/nagios/etc/objects/commands.cfg and change part of notify-host-by-email and notify-service-by-email lines from:

from: /bin/mail
to: /usr/bin/mail

Now check to make sure there are not any issues with Nagios' config files and set a server or other device to alert, and you should be good to go.

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Leave a Reply

Your email address will not be published. Required fields are marked *