Setup ICINGA Email Alerts via SSMTP in Ubuntu 16.04 - Untold.IT


Post Top Ad

Friday, December 22, 2017

Setup ICINGA Email Alerts via SSMTP in Ubuntu 16.04

ICINGA 2 is an open source monitoring system which checks the availability of your network resources, notifies users of outages, and generates performance data for reporting. This tool works pretty well and its structure runs smoothly. But all of its features are useless if you will not be notified whenever a system in your network went down.

Today, we will discuss the step by step guide on how you can setup email alerts in Ubuntu 16.04 using SSMTP and Gmail account for Icinga notifications.

Let's Start:


  1. Ubuntu 16.04 Server
  2. Icinga 2
  3. Gmail Account


Update Ubuntu Repository

$ sudo apt-get update

Install the SSMTP package

$ sudo apt-get install ssmtp

Install Postfix

$ sudo apt-get remove --purge postfix

$ sudo apt-get install postfix-mysql

On the next screen select "Internet Configuration"

Enter the domain of the site:

Normally continue the installation

Install Mail Utilities

$ sudo apt-get install mailutils

Restart Icinga2 service

$ sudo systemctl restart icinga2

Configure SSMTP:

Edit the configuration file.

$ sudo nano /etc/ssmtp/ssmtp.conf

Adjust and add as necessary to match the following parameters.

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

# 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
hostname=<your 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

Create aliases for local usernames.

Edit the revaliases file.

$ sudo nano /etc/ssmtp/revaliases

Add the users as stated below.


Allow Postfix on firewall:

If you are running the UFW firewall, we'll have to allow and exception for Postfix.
$ sudo ufw allow postfix

Configure Postfix:
$ sudo nano /etc/postfix/
Change mydestination value as seen below.
. . .
mydestination =, localhost, localhost.localdomain
. . .

Setting Up Notifications
To get email notifications working, update the email address icinga is sending to:
$ sudo nano /etc/icinga2/conf.d/users.conf
Change the email line to the address you'd like to receive notifications at:
. . .
email= "<>"
. . .
$ sudo systemctl restart icinga2

Check Setup:
To check the setup with verbosity output.
$ echo "test email" | sudo ssmtp -vvv <youremailaddress>
To check if icinga email notification is configured successfully.
$ echo "test email" | mail -s "test mail subject" <youremailaddress>

No comments:

Post a Comment

Post Top Ad