In this article we will set up the supervision of a network with Icinga2
- A server machine (debian)
- A client machine(We can use any OS)
CONFIGURATION OF THE ICINGA2 SERVEUR
We start by adding the deposits necessary for the installation of Icinga2.
echo 'deb http://packages.icinga.org/debian icinga-jessie main' >>/etc/apt/sources.list echo 'deb-src http://packages.icinga.org/debian icinga-jessie main' >>/etc/apt/sources.list
Then we get the key.
wget -O - http://packages.icinga.com/icinga.key | apt-key add -
Then we update our machine.
apt-get update && apt-get upgrade -y
Installation of Icinga2
We install icinga and mysql.
apt-get install -y icinga2
And we launch the Icinga2 service.
service icinga2 start
Now we install the MySQL database needed by Icinga2.
apt-get install -y mysql-server mysql-client
You will just have to enter the password you want for the MySQL administrator.
Remember the password, it will serve us for the next step.
Finally we install icinga2-ido-mysql to allow Icinga2 to save the data to the database.
apt-get install icinga2-ido-mysql
A first window will appear during the installation and ask you if you want to activate the ido-mysql feature, select NO.
Then on the second window, select YES to let icinga2-ido-mysql create the database in MySQL.
For the rest of the installation, we are asked for the password of the MySQL administrator that we defined previously.
Finally, we will define the password that icinga-ido-mysql will use to access the database we just created.
In case you do not remember this informations, you can find it in the ido-mysql.conf file.
To check which features are enabled, type the command
icinga2 feature list
Now we enable the ido-mysql feature to allow data to be saved on MySQL and enable the command feature to allow the web interface to send commands to the Icinga server.
icinga2 feature enable ido-mysql command
We restart the icinga2 service so that it takes into account the functions ido-mysql and command.
service icinga2 restart
Installing the Icingaweb2 web interface
We install apache2 and Icingaweb2.
apt-get install -y apache2 icingaweb2
We will now specify the date.timezone in the /etc/php5/apache2/php.ini file.
date.timezone = europe/paris
Then we install php5 modules necessary for Icingaweb2 to work properly.
apt-get install -y php5-intl php5-imagick php5-gd
To take into account these different modules, restart apache2.
service apache2 restart
We then need to generate a token to begin the installation and configuration of Icingaweb2 from a graphical interface on the web page of the Icinga2 server.
icingacli setup token create
Remember this token.
Then go to the web page of your Icinga2 server:
(With « X.X.X.X » as the IP addresse of your Icinga2 server.)
To start the configuration, we are obliged to enter the token we just created and click on « next ».
Then we select the « Monitoring » module and click on « next ».
The next page will check if the modules necessary for the operation of Icingaweb2 are present.
If everything is correct, all the modules must be in green except the PDO-PostgreSQL module which is not necessary in our case because we use MySQL and not PostgreSQL.
If not look at the missing modules, install them and click « refresh » at the bottom of the page to check if they are now properly installed.
We click on « next » and on the next page we select « database » as type of authentication.
And click on « next ».
For the next page, we need to configure access to the MySQL database.
For this tutorial I used the user « root » but for security reasons, it is safer to create a new user with the necessary rights.
To be sure of the configuration that has been filled in, we can click on « Validate Configuration » at the bottom of the page, if it sends you this message, everything is good and we can click on « next ».
On the next page we leave the name of the backend name by default and click on « next »
Then we will have to create the administrator account of the web interface and we click on « next ».
For the rest we leave by default and click on « next ».
Before continuing further, the next page will give you a quick summary of the configurations that have just been done.
Click on « next » until you reach this page
From here, we have to configure the sources of the information ie where the information comes from.
On the next page we need to define how the orders will be sent to supervise.
Finally, we define the variables that must be protected for the security of information that circulates through a regular expression.
now your supervision server is configured.