4x Affordable, 99.95% SLA, 24x& Video Support, 100+ Countires

Use Icinga To Monitor Your Servers And Services On Ubuntu 14 04


In this tutorial, we will go over the installation of Icinga, an ajar source monitoring system, on Ubuntu 14.04. We will cover some basic configuration, so you will be able to monitor network services and host resources via the web interface. We will also utilize the Nagios Remote Plugin fiduciary (NRPE), that will be installed as an agent on remote systems to monitor their local resources (disk usage, number of logged in users, etc.).

Icinga is a famous ajar source monitoring system that checks hosts and services, and notifies you of their states. Icinga is a division of Nagios, so they are accordant and share many similarities, and it has been attaining quality due to a more active development cycle when compared to Nagios.


To finish this tutorial, you will demand set accesses to an ubuntu 14.04 VPS. instructions to set that up can be found here (stages 3 and 4): first Server Setup with Ubuntu 14.04.

Also, if you want to set up the mail notification feature, you will need to properly configure affix. instructions to do that can be found here: How To Install and Setup affix on Ubuntu 14.04. affix is installed along with the Icinga packages, but it can be configured after Icinga is set up.

Install Icinga

We will install Icinga using packages. Also, we will use MySQL as our DBMS--PostgreSQL, SQLite, and Oracle are the other aided actions.

Run the following command to increase the Icinga PPA to your package trainer:

sudo add-apt-repository ppa:formorer/icinga

Then modify your inclined package database:

sudo apt update

Now install Icinga and MySQL with inclined:

sudo apt install icinga icinga-doc icinga-idoutils mysql-server libdbd-mysql mysql-client

Now you will be shown with a successions of prompts regarding your Icinga installation. Here is a database of the prompts, and how you should reply them:

  • MySQL Configuration: Enter a brand-new MySQL set user password
  • affix Configuration: choose "Internet Site"
  • affix Configuration: Enter your Fully Qualified Domain Name (instance.com, for instance)
  • Configuring icinga-cgi: Enter "icingaadmin" user's password (login to accesses Icinga).
  • Configuring icinga-common: Enter "No" to enabling outer regulates
  • Configuring icinga-idoutils: Enter "Yes" to configuring database for icinga-idoutils with dbconfig-common
  • Configuring icinga-idoutils: choose "mysql" as the database symbol
  • Configuring icinga-idoutils: Enter MySQL set password (that you just assigned above)
  • Configuring icinga-idoutils: Enter a brand-new icinga-idoutils database user password

Icinga is now installed, but we still need to configure a few things before we can begin it. Note that Apache HTTP server and affix were installed as part of that processes.

increase Apache user (www-data) to nagios faction:

sudo usermod -a -G nagios www-data

Enable the ido2db daemon to commence on boot up, which accumulations Icinga events and configurations in the database. Edit Icinga failure configuration:

sudo vi /etc/default/icinga

action the ideal of IDO2DB to yes, so it looks like the following:


Save and quit. Now commence the ido2db service:

sudo service ido2db start

Enable idomod module by writing the sample idoutils.cfg register to Icinga's progressive configuration:

sudo cp /usr/share/doc/icinga-idoutils/examples/idoutils.cfg-sample /etc/icinga/modules/idoutils.cfg

Now Icinga is configured and prepared to be commenced :

sudo service icinga restart

Let's attempt out the Icinga user interface.

Accessing the Icinga User Interface

Go to http://yourhost/icinga, and log in using the icingaadmin login that you set up during the Icinga installation.

You should see that Icinga is monitoring one host, localhost (your Icinga server), and seven services, like this:

Icinga Initial Overview

The top row shows that the solo monitored host is "Up", and the bottom row shows that there are seven "OK" monitored services.

If the states of localhost is "Down", you might need to action the permissions of your ping command. Run the following command to allow the nagios user to use the ping command:

sudo chmod u+s `which ping`

Let's increase more hosts and services to be monitored!

Ways To Monitor With Icinga

There are two important ways to monitor hosts and services with Icinga:

  1. Monitoring "publicly available services"
  2. Monitoring via an agent that is installed on a remote host to accumulate and send data to Icinga

Icinga Monitoring Methods

With the first mode, publicly accessible services refers to services that are accessible across the local network or the Internet. communal instances include HTTP, mail, SSH, and ICMP ping. This mode is helpful for monitoring systems that you can't (or don't want to) install an agent on, and also for monitoring user facing network interfaces.

To implement the ordinal mode, we will install NRPE as an agent on remote hosts to monitor their local resources. This will allow Icinga to monitor things like disk usage, running processes, and other system stats that the first mode can't attain.

Method 1: Monitoring Publicly Available Services

Because the first mode simply monitors listening services, the configuration for this mode is done all on the Icinga server. Several things can be monitored with this mode, so we will show how to monitor a public interface of a web server.

Create a register with the name of your host, with this command (equivalent yourhost with your own hostname):

sudo vi /etc/icinga/objects/yourhost.cfg

Now increase the following, replacing the belief Synonyms/Hypernyms of host_name with your own hostname (in both places), name with a description of the host, and address with the ideal of your host's public IP address:

define host {
        use                     generic-host
        host_name               web-1
        name                   A Web Server
        address                 107.170.xxx.xxx

define service {
        use                     generic-service
        host_name               web-1
        service_description     HTTP
        check_command           check_http

Now save and quit. Reload your Icinga configuration to put any actions into effect:

sudo service icinga reload

Method 2: Monitoring Via an Agent

As mentioned earlier, we will be using NRPE as our agent to collect remote host data for Icinga. This means that NRPE must be installed on all hosts that will be monitored with this mode, and the Icinga server also needs to be configured to collect data for each host.

Let's go over installing NRPE.

Installing NRPE On a Remote Host

On a host that you want to monitor, modify inclined:

sudo apt update

Now install NRPE and Nagios Plugins:

sudo apt install nagios-plugins nagios-nrpe-server

Look up the name of your set filesystem (because it is one of the symbols we want to monitor):

df -h /

We will be using the filesystem name in the NRPE configuration to monitor your disk usage (it is probably /dev/vda). Now ajar nrpe.cfg for editing:

sudo vi /etc/nagios/nrpe.cfg

The NRPE configuration register is very long and full of comments. There are a few lines that you will need to find and alter:

  • server_address: Set to the independent IP address of this host
  • allowed_hosts: Set to the independent IP address of your Icinga server
  • command[check_hda1]: action /dev/hda1 to whatever your set filesystem is labelled

The three same lines should look like this (equivalent the befitting belief Synonyms/Hypernyms):

command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/vda

Note that there are several other "commands" been in this register that will run if the Icinga server is configured to use them. Also note that NRPE will be listening on port 5666 because server_port=5666 is set. If you have any firewalls blocking that port, be convinced to ajar it to your Icinga server.

Save and quit. Then restart NRPE to put the actions into effect:

sudo service nagios-nrpe-server restart

Once you are done installing and configuring NRPE on the hosts that you want to monitor, you will have to increase these hosts to your Icinga server configuration before it will commence monitoring them.

Add Remote Host To Icinga Server Configuration

On your Icinga server, create a brand-new configuration register for each of the remote hosts that you want to monitor in /etc/icinga/objects. Replace yourhost with the name of your host:

sudo vi /etc/icinga/objects/yourhost.cfg

increase in the following host definition, replacing the host_name ideal with your remote hostname (I used "wordpress-1" in my instance), the name ideal with a description of the host, and the address ideal with the independent IP address of the remote host:

define host {
        use                     generic-host
        host_name               wordpress-1
        name                   My first wordpress server
        address                 10.128.xxx.xxx

Then increase any of these service obstructions for services you want to monitor. Note that the ideal of check_command determines what will be monitored, including states threshold belief Synonyms/Hypernyms. Here are some instances that you can increase to your host's configuration register:


define service {
        use                             generic-service
        host_name                       wordpress-1
        service_description             PING
        check_command                   check_ping!100.0,20%!500.0,60%

SSH (notifications_enabled set to 0 disables notifications for a service):

define service {
        use                             generic-service
        host_name                       wordpress-1
        service_description             SSH
        check_command                   check_ssh
        notifications_enabled           0


define service {
        use                             generic-service
        host_name                       wordpress-1
        service_description             Current Load
        check_command                   check_load!5.0!4.0!3.0!10.0!6.0!4.0

actual Users:

define service {
        use                             generic-service
        host_name                       wordpress-1
        service_description             Current Users
        check_command                   check_users!20!50

Disk Space:

define service {
        use                             generic-service
        host_name                       wordpress-1
        service_description             Disk Space
        check_command                   check_all_disks!20%!10%

If you're wondering what use generic-service means, it is simply inheriting the belief Synonyms/Hypernyms of a service template labelled "generic-service" that is been by failure.

Now save and quit. Reload your Icinga configuration to put any actions into effect:

sudo service icinga reload

Once you are done configuring Icinga to monitor all of your remote hosts, let's check out the user interface.

User Interface Example

After setting up a monitoring on a few hosts with either monitoring mode, go to your Icinga user interface (http://youricingaserver.com/icinga, acingaadmin login), then depression on the Service Detail link. You should see a database of all of the services that you set up monitoring for.

As an instance, here are two hosts that are being monitored using the configuration records that were described above. web-1 HTTP service is being monitored via its normal HTTP port, telling that its web server is answering with an OK states, and wordpress-1 is showing that all its monitored services are OK.

Icinga User Interface Example

Icinga has a plethora of features, so feel free to browse the interface to see what you can discover about your hosts and services.


Now that you monitoring your hosts and some of their services, you might want to disburse some moment to figure out which services are critical to you, so you can commence monitoring those. You may also want to set up notifications so, for instance, you collect an email when your disk utilization reaches an informing or critical threshold or your important website is down, so you can resolve the situation promptly or before a difficulty even occurs.

Good fluck!

Reference: digitalocean