Install Icinga Monitoring Tool on Ubuntu

Icinga is an enterprise-grade open-source monitoring system which keeps watch over networks and any conceivable network resource, notifies the user of errors and recoveries and generates performance data for reporting. Scalable and extensible, Icinga can monitor complex and large environments across dispersed locations.

Icinga is a fork of Nagios and is backward compatible. Nagios configurations, plugins and add-ons can all be used with Icinga. Though Icinga retains all the existing features of its predecessor, it builds on them to add many long awaited patches and features requested by the user community.

Install Icinga On Ubuntu

This article is done on Ubuntu 12.10 server, but it may work on all Debian/Ubuntu derivatives.

First install dbconfig-common package. This is useful while Icinga database installation process.

Login to root user:

$ su

Enter the command to install dbconfig-common package:

# apt-get install dbconfig-common

Add Icinga Repository

If ‘add-apt-repository’ command doesn’t work, install the following package:

# apt-get install python-software-properties

Add Icinga repository with command on Ubuntu:

# add-apt-repository ppa:formorer/icinga

Update sources list:

# apt-get update

Now install Icinga and its dependencies with following command:

# apt-get install icinga icinga-idoutils mysql-server libdbd-mysql mysql-client

If you don’t use external commands with Icinga, Select No.

root@server1: -home-sk_005Select your web server.

root@server1: -home-sk_006Enter Icinga web administration password.

root@server1: -home-sk_007Re-enter password.

root@server1: -home-sk_009Select Yes to configure icinga-idoutils.

root@server1: -home-sk_010Select the database to be used by Icinga.

root@server1: -home-sk_011Enter MySQL root user password.

root@server1: -home-sk_012Enter MySQL application password for Icinga.

root@server1: -home-sk_013Re-enter password.

root@server1: -home-sk_014Now access your Icinga interface by navigating to http://192.168.1.201/icinga with username ‘icingaadmin’ and the password that you have created during installation.

Mozilla Firefox_015Now you will able to access Icinga interface as shown below.

Icinga: 192.168.1.201 - Mozilla Firefox_016Configure idoutils

Create a file /etc/icinga/modules/idoutils.cfg:

# nano /etc/icinga/modules/idoutils.cfg

Add the following lines:

define module{
        module_name     idomod
        module_type     neb
        path            /usr/lib/icinga/idomod.so
        args            config_file=/etc/icinga/idomod.cfg
        }

Create symbolic links with following command:

# ln -s /usr/lib/icinga/idomod.so /usr/sbin/

Configure ido2db

Open the file /etc/default/icinga:

# nano /etc/default/icinga

Find the line:

# start ido2db daemon (no/yes)
IDO2DB=no

Change the value ‘no’ to ‘yes’:

# start ido2db daemon (no/yes)
IDO2DB=yes

Now start ido2db and restart icinga services:

# /etc/init.d/ido2db start
# /etc/init.d/icinga restart

Monitor Remote Hosts with Icinga

Install nrpe and nagios plugins in your remote system. For instance, here I use my Lubuntu 13.04 desktop.

To install nrpe & nagios-plugins, enter the command:

$ sudo apt-get install openssl nagios-nrpe-server nagios-plugins nagios-plugins-basic nagios-plugins-standard

Now open /etc/nagios/nrpe.cfg file:

$ sudo nano /etc/nagios/nrpe.cfg

Find the line:

# server_address=127.0.0.1

Uncomment and add your Icinga server IP address as shown below:

server_address=127.0.0.1 192.168.1.201

Here 192.168.1.201 is my Icinga server IP address. Restart nrpe to save changes:

$ sudo /etc/init.d/nagios-nrpe-server restart

Add Remote Hosts to Icinga Server

Now go back to Icinga server side and do the following steps. Open the file /etc/icinga/objects/localhost_icinga.cfg:

# nano /etc/icinga/objects/localhost_icinga.cfg

Add the following lines next to the localhost template:

define host{
        use                     generic-host            ; Name of host template$
        host_name               sk     
        alias                   sk     
        address                 192.168.1.100 
        }

Here 192.168.1.100 is my local Lubuntu 13.04 desktop.

Add Services for Remote Hosts in Icinga Server

To add a service scroll down further in icinga configuration file. You will find a service templates as shown below. Just add your remote hostname to be monitored separated with comma(,). See the red coloured text:

define service{
        use                             generic-service         ; Name of servi$
        host_name                       localhost,sk
        service_description             Disk Space
        check_command                   check_all_disks!20%!10%
        }

Now restart icinga services:

# /etc/init.d/icinga restart

Login to icinga web interface with URL http://icinga-ip-address/icinga and check for the remote hosts.

Icinga: 192.168.1.201 - Mozilla Firefox_017As you see in the above screenshot my remote host Lbuntu which has hostname “sk” is added. Click on the host to see additional information.

Icinga: 192.168.1.201 - Mozilla Firefox_019That’s it. Now add your hosts and hosts services as shown above and monitor them effectively.

References:

Icinga Website

AskUbuntu