Setup Icinga Monitoring Tool on CentOS 7 / RHEL 7

Icinga Logo

Icinga is a fork of famous Ngaios monitoring tool, it is very compatible with Nagios and can be integrated with Nagios plugins. Icinga is very similar to Nagios, so you wont find any difficult in moving to Icinga. Icinga is one step ahead on multiple factors, the import factor is advanced reporting using we based jasper reports,  the most improved web interface and its comes as virtual appliance.

This post will help you to setup Icinga on CentOS 7 / RHEL 7.

Prerequisites:

Before we go ahead, lets install the required packages for Icinga.

# yum -y install wget httpd mod_ssl gd gd-devel mariadb-server php-mysql php-xmlrpc gcc mariadb libdbi libdbi-devel libdbi-drivers libdbi-dbd-mysql

Disable SELinux.

sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

Reboot once done.

Create icinga user and icinga-cmd group (allowing the external commands to be executed through the web interface) , add  icinga and apache user to the part of icinga-cmd group.

# useradd icinga
# groupadd icinga-cmd
# usermod -a -G icinga-cmd icinga
# usermod -a -G icinga-cmd apache

Download latest Icinga source tarball.

# cd /tmp/
# wget http://downloads.sourceforge.net/project/icinga/icinga/1.10.1/icinga-1.10.1.tar.gz
# tar -zxvf /tmp/icinga-1.10.1.tar.gz
# cd /tmp/icinga-1.10.1

Compile and Install Icinga:

# ./configure --with-command-group=icinga-cmd --enable-idoutils
# make all
# make install
# make install-init
# make install-config
# make install-commandmode
# make install-webconf
# make install-idoutils

Configure Icinga:

Sample configuration files have now been installed in the /usr/local/icinga/etc/ directory. These sample files should work fine for getting started with Icinga. You’ll need to make just one change before you proceed. Edit the /usr/local/icinga/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you’d like to use for receiving alerts.

# vi /usr/local/icinga/etc/objects/contacts.cfg

Change the Email address field to receive the notification.

email                           icinga@localhost

to

email                           icinga@itzgeek.com

Move sample idoutils configuration files to Icinga base directory.

# cd /usr/local/icinga/etc/
# mv idomod.cfg-sample idomod.cfg
# mv ido2db.cfg-sample ido2db.cfg
# cd modules/
# mv idoutils.cfg-sample idoutils.cfg

Create database for idoutils:

# systemctl start mariadb.service
# mysql -u root -p
MariaDB [(none)]> CREATE DATABASE icinga;
MariaDB [(none)]> GRANT USAGE ON icinga.* TO 'icinga'@'localhost' IDENTIFIED BY 'icinga' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> quit

Import Database.

# mysql -u root -p icinga < /tmp/icinga-1.10.1/module/idoutils/db/mysql/mysql.sql

Configure Web Interface:

Create a icingaadmin account for logging into the Icinga web interface. Remember the password that you assign to this user – you’ll need it later.

# htpasswd -c /usr/local/icinga/etc/htpasswd.users icingaadmin

Restart Apache to make the new settings take effect.

systemctl restart httpd.service

Download and Install Nagios Plugins:

Download Nagios Plugins to /tmp directory.

# cd /tmp
# wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
# tar -zxvf /tmp/nagios-plugins-2.0.3.tar.gz
# cd /tmp/nagios-plugins-2.0.3/

Compile and install the plugins.

# ./configure --prefix=/usr/local/icinga --with-cgiurl=/icinga/cgi-bin --with-nagios-user=icinga --with-nagios-group=icinga
# make
# make install

Starting Icinga:

Verify the sample Icinga configuration files.

# /usr/local/icinga/bin/icinga -v /usr/local/icinga/etc/icinga.cfg

If there are no errors, start Nagios and Idoutils.

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

Start Icinga and Idoutils on system startup.

# chkconfig ido2db on
# chkconfig icinga on
# systemctl enable httpd.service
# systemctl enable mariadb.service

Access Web Interface:

Now access Icinga web interface using the following URL. You’ll be prompted for the username (icingaadmin) and password you specified earlier.

http://ip-address/icinga/
CentOS 7 - Icinga Dashboard
CentOS 7 – Icinga Dashboard

Click on service details to check the status.

CentOS 7 - Icinga localhost Service details
CentOS 7 – Icinga localhost Service details

Troubleshooting:

If you get any unknown waring for ping check.

CentOS 7 - Icinga Ping Unknown Warning
CentOS 7 – Icinga Ping Unknown Warning

please execute the following command in the terminal to resolve the issue.

# chmod u+s /bin/ping

If you get any waring for httpd check.

CentOS 7 - Icinga Httpd Warning
CentOS 7 – Icinga Httpd Warning

Place index.html on document root.

# echo "Home Page" > /var/www/html/index.html

That’s All!. You have successfully installed Icinga on CentOS 7 / RHEL 7

POSTS YOU MAY LIKE -:)

Share This Post

  • Hey Bud:

    In the section: Compile and Install Icinga:

    ./configure –with-command-group=icinga-cmd –enable-idoutils

    you missed:

    ./configure –with-command-group=icinga-cmd –enable-idoutils=no

    The absence of the full command generates the error:

    configure: error: ERROR – We really need a libdbi to link against

    Thanks for Sharing, I appreciated!

  • Vasim

    Thanks!!!

  • Dean

    This was the most accurate and quickest procedure I’ve found to get Icinga up and running. Thanks.

  • Pedro Arantes

    thanks man! my machine is running icinga on centOS 7

  • Eric

    I’d recommend not disabling SELinux. Maybe set permissive and then run audit2allow. Never ever set disabled, You loose the managing of labels and that makes enabling SELinux difficult. I’d love to see someone’s SELinux Policy file and would suggest bugs/defects be opened for failing to distribute a policy file. https://wiki.centos.org/HowTos/SELinux

  • proftech

    Thanks to this articles… my project is up and running with icinga on centOS 7 installed on Hyper-V Manager, now i can monitor our IT Infrastructure… thanks ITzGeek…

  • Triple H DX

    I got a error message. Could you tell me how to fix

    [root@dsgicinga ~]# systemctl status ido2db.service
    ● ido2db.service – LSB: Icinga IDO2DB Initscript
    Loaded: loaded (/etc/rc.d/init.d/ido2db)
    Active: failed (Result: exit-code) since 二 2016-01-26 14:59:10 CST; 11s ago
    Docs: man:systemd-sysv-generator(8)
    Process: 4808 ExecStart=/etc/rc.d/init.d/ido2db start (code=exited, status=1/FAILURE)

    1月 26 14:59:10 dsgicinga.deanshoes.com systemd[1]: Starting LSB: Icinga IDO2DB Initscript…
    1月 26 14:59:10 dsgicinga.deanshoes.com ido2db[4808]: Ido2db PID not running. Removing lockfile.
    1月 26 14:59:10 dsgicinga.deanshoes.com ido2db[4817]: IDO2DB 1.13.3 (07-15-2015) Copyright(c) 2005-2008 Ethan Galstad, Copyright(c) 2009-2015 Ic…nga.org)
    1月 26 14:59:10 dsgicinga.deanshoes.com ido2db[4817]: IDO2DB 1.13.3 starting… (PID=4817)
    1月 26 14:59:10 dsgicinga.deanshoes.com ido2db[4817]: Error: Could not connect to mysql database: 1045: Access denied for user ‘icinga’@’localho…rd: YES)
    1月 26 14:59:10 dsgicinga.deanshoes.com ido2db[4808]: Starting Ido2db: done.
    1月 26 14:59:10 dsgicinga.deanshoes.com systemd[1]: ido2db.service: control process exited, code=exited status=1
    1月 26 14:59:10 dsgicinga.deanshoes.com systemd[1]: Failed to start LSB: Icinga IDO2DB Initscript.
    1月 26 14:59:10 dsgicinga.deanshoes.com systemd[1]: Unit ido2db.service entered failed state.
    1月 26 14:59:10 dsgicinga.deanshoes.com systemd[1]: ido2db.service failed.
    Hint: Some lines were ellipsized, use -l to show in full.

    • Seems issue in connecting to MySQL database, please check.

      1月 26 14:59:10 dsgicinga.deanshoes.com ido2db[4817]: Error: Could not connect to mysql database: 1045: Access denied for user ‘icinga’@’localho…rd: YES)

      • Triple H DX

        Ok thanks

    • Russ

      I got this same error, I fixed it by changing the GRANT statement from GRANT OPTION to GRANT ALL.
      GRANT ALL ON icinga.* TO ‘icinga’@’localhost’ IDENTIFIED BY ‘icinga’;

Shares