Icinga is an open source enterprise monitoring system that monitors networks and any significant network resources, notifies the user of errors, recoveries and generates information performance for reporting.
It was originally created as a fork of the Nagios system monitoring application in 2009. The Icinga developers also seek to reflect community needs more closely and to integrate patches more quickly.
Why Icinga? To gain control over the resources available on our network (Servers, Switches, Routers, etc.), which would prevent possible failures before they occur.
Some of its characteristics are:
- Performance oriented: Icinga 2 is built to be fast. Thanks to its multithreaded design, it can run thousands of checks each second without any sign of CPU strain.
- Distributed: combine high availability clusters with a distributed setup, and you have a best practice scenario for large and complex environments.
- Rule based Configuration:monitoring as code with dynamic configurations. Apply rules to hosts and services to create a continuous monitoring environment.
Installation on CentOS 7
Adding Icinga repository and installing Icinga2
There is an Icinga repository for Red Hat Linux, and therefore it is compatible with CentOS. Add the repository:
              sudo -i
Then we enter our password and we are already a root user.
After that, we wrote the following:
              yum install https://packages.icinga.com/epel/icinga-rpm-release-7-latest.noarch.rpm
For this tutorial you need to have the EPEL repository activated, if you do not have it activated you can do it with the following command:
              yum install epel-release
Once the installation process is complete, we proceed to install Icinga2:
             yum install icinga2
Once the package is installed, we proceed to start and enable the service.
            systemctl start icinga2
And:
            systemctl enable icinga2
By default, the installation of icinga2 enables three functionalities: checker, notification and maillog. With the following instruction, we can see all the features:
            icinga2 feature list
As it was said before, Icinga is a Nagios fork, bringing as an advantage the compatibility with its plugins. Thanks to the EPEL repository, it’s just a command.
             yum install nagios-plugins-all
If we manage CentOS security with the selinux control system.
            yum install icinga2-selinux
Then we must restart the service
            systemctl restart icinga2
DB IDO on Icinga2 – Installing MariaDB
Icinga2 works with a DBMS that can be either MariaDB or postgreSQL. In this case we will use MariaDB, if we don’t have it installed, we must do it:
              yum install mariadb-server mariadb
After that, we must to enable it and start it:
            systemctl enable mariadb
And:
            systemctl start mariadb
With the mysql_secure_installation script we can define the password and other options of MariaDB. We answer Y,N,Y,Y.
               mysql_secure_installation
At this point we must install the Ido-mysql module or functionality:
             yum install icinga2-ido-mysql
Now we will create the user and database dedicated to icinga2. We’re accessing the mariadb console:
mysql -u root -p
Once logged in, we proceed to create the database:
              CREATE DATABASE icinga2;
And later, we will create the user dedicated to icinga, with his password and with permissions to alter everything in the icinga2 database:
             GRANT ALL PRIVILEGES ON icinga2.* TO ‘icinga2user’@’localhost’ IDENTIFIED BY ‘icinga2pss’;
Now we must repeat the process but for icinga web:
              CREATE DATABASE icinga2web;
              GRANT ALL PRIVILEGES ON icinga2web.* TO ‘icinga2webuser’@’localhost’ IDENTIFIED BY ‘icinga2webpss’;
And finally, we must to refresh all privileges:
              FLUSH PRIVILEGES;
We leave the mariadb console with exit. And to import the mysql ido schema into our mariadb configuration, we write:
              mysql -u root -p icinga2 < /usr/share/icinga2-ido-mysql/schema/mysql.sql
We enabled the icinga2 module gone mysql and then restarted the service.
             icinga2 feature enable ido-mysql
After that:
             systemctl restart icinga2
Instalando Icinga 2 Web
Until now we have installed the server part of Icinga2, now it is the turn of the web interface that works with a web server. We chose apache in this tutorial, installed it, enabled it and started the service.
              yum install httpd
To enable it:
                 systemctl enable httpd
and to start it:
                systemctl start httpd
And we execute the following commands to enable the port in the firewall:
             firewall-cmd –add-service=http
And:
            firewall-cmd –permanent –add-service=http
Icinga2web uses REST API for its internal processes and we must enable it to get full functionality.
We enabled it with the command:
            icinga2 api setup
Now we will edit the file: api-users to define username and password:
             nano /etc/icinga2/conf.d/api-users.conf
We replace user and password with the one we want.
In my case:
Another file we need to edit is the ido-mysql.conf to match the mariadb parameters we have configured.
In this case the file looks like this.
And now, we restart the icinga2 service.
            systemctl restart icinga2
Now we must enable the SCL repository to continue with the installation in an optimal way.
             yum install centos-release-scl
We proceed to install Icinga Web 2
           yum install icingaweb2 icingacli
If you use SELinux, then you will also need to install:
              yum install icingaweb2-selinux
The next thing you need to do is to install packages to work with FPM (FastCGI Process Manager):
              yum install rh-php71-php-fpm
Start the service:
             systemctl start rh-php71-php-fpm.service
And enable it:
             systemctl enable rh-php71-php-fpm.service
Now the module for mysql:
             yum install rh-php71-php-mysqlnd
And restart the service:
             systemctl restart rh-php71-php-fpm.service
We must now create a token that we will use in the web installer.
              icingacli setup token create
Finally we must restart apache
            systemctl restart httpd
It is highly recommended to modify the timezone in /etc/opt/rh/rh-php71/php.ini. In my case I’ll put America/caracas.
           nano /etc/opt/rh/rh-php71/php.ini
We restart the apache services and the php fpm.
              systemctl restart httpd
              systemctl restart rh-php71-php-fpm
And with this we can complete the installation from our web browser.
             http://IP_SERVER/icingaweb2/
In that initial screen we must add the token we have generated and click on next.
The following screen shows the active modules: Activate Doc and Monitoring:
On the next screen, verify that we meet the software requirements.
Next it asks us the form of authentication: we choose database.
Next, on the next screen, we will place the requested parameters of mariadb. Click on next.
The next screen is for naming the backend. We leave it the same. Click on next.
Now it’s time to set up the administrative account
It is the turn of the log. We left everything the same.
Check that everything is on the screen shown and click next.
And now, monitoring module:
The screen that will be shown is the backend monitoring screen, we leave everything the same.
In the next screen, we must place the parameters of MariaDB for icinga.
Now we must configure command transport with the parameters that we configure in the file: etc/icinga2/conf.d/api-users.conf
On the next screen we leave it the same:
we’ll see the summary and that’s it.
We have already successfully completed the installation process.
Now we can log in.
And we can finally get into the dashboard. If we can see it, it means everything went great.
Icinga2 is a great Nagios-based network monitoring program. Its installation under CentOS is a bit long but the process is not complex and does not require much effort.
Please share this tutorial on social networks for your friends to take advantage of.