Icinga2 is a very robust, almost to much, monitoring system. After trying a few others LibreNMS, Zabbix, and a few others, I decided that icinga2 was the best one to work with for my purposes.

This will get a very simple one server setup going. Icinga2 farms can get a LOT bigger though. Luckily they scale pretty well.

For the mail command which is used in notifications.

yum install -y mailx

Install the Icinga2 repo

yum -y install https://packages.icinga.org/epel/7/release/noarch/icinga-rpm-release-7-1.el7.centos.noarch.rpm

Install Icinga2

yum -y install icinga2
systemctl enable icinga2
systemctl start icinga2

You should now be able to see the installed features.

icinga2 feature list

Enable external commands.

icinga2 feature enable command

Install the monitoring plugins and restart icinga2.

yum -y install nagios-plugins-all
systemctl restart icinga2

The above steps get Icinga2 installed but it doesn’t have a web interface, so next we’ll install MariaDB and Icinga2web. Icinga2web uses MariaDB to store it’s configuration. Setting up the DB. For the last step, you are just locking down the mariadb instance a bit for better security.

yum -y install mariadb-server mariadb
systemctl enable mariadb
systemctl start mariadb
mysql_secure_installation
yum -y install icinga2-ido-mysql

Next we created the DB so open a SQL console.

mysql -u root -p

You will want to change the password for the icinga user in the GRANT command below to something safe.

CREATE DATABASE icinga;
GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE ON icinga.* TO 'icinga'@'localhost' IDENTIFIED BY 'icinga';

Import the DB schema

mysql -u root -p icinga < /usr/share/icinga2-ido-mysql/schema/mysql.sql

Enable the IDO Mysql module.

icinga2 feature enable ido-mysql

Install and setup the web server. Apache in this case.

yum -y install httpd
systemctl enable httpd
systemctl start httpd

Now we can install icingaweb2. You can omit php-ldap if you aren’t going to use ldap authentication.

rpm --import http://packages.icinga.org/icinga.key
curl -o /etc/yum.repos.d/ICINGA-release.repo http://packages.icinga.org/epel/ICINGA-release.repo
yum makecache

yum -y install epel-release

yum -y install icingaweb2 icingacli
yum -y install php-ldap php-mysql

Set the php timezone using your favorite text editor. /etc/php.ini

date.timezone = America/Chicago

When running the setup icingaweb2 will do a http check that will fail unless an index.html exists. Then just restart apache.

touch /var/www/html/index.html
systemctl restart httpd

You will still need to generate a token for the web setup though. To do so run:

icingacli setup token create

The token will be needed for the web setup.

You should now be able to go to: http://yourIP/icingaweb2/setup

At this point you should have a working icinga2 and icingaweb2 setup. You can either start adding hosts and services via text files, or as I like to do, install Director. Director is wonderful and makes the whole icinga2 experience so much better. I’ll talk about it in the next post.