How to install Icinga on Ubuntu 19.10

Robert Garrigos

Robert Garrigos

Mar 13 — 3 min.s llegir

Icinga is an open source monitoring and alerting system I just discovered. I learned to install it on a Centos 7, but wanted to install on an Ubuntu 19.10 and couldn't find any instructions. There a few differences and caveats to consider:

Install Apache and PHP

sudo apt install apache2 libapache2-mod-php

Icinga2 is not yet compatible with php 7.4, the default on Ubuntu 19.10 as of today, so you need to install php 7.3 and the required modules:

sudo apt install php7.3 php7.3-{xml,cli,gd,intl,readline,mysql,curl,mbstring,ldap,json,opcache}

Edit php.ini file to set the proper time zone:

sudo vim /etc/php/7.3/apache2/php.ini

Set your time zone:

date.timezone = Europe/Andorra

Install imagemagick

sudo apt install imagemagick

You can now restart Apache:

sudo systemctl restart apache2

Install MySQL

sudo apt install mysql-server

Secure MySQL installation

sudo mysql_secure_installation

Icinga uses two databases, one for the core of the system (icinga), and another one for the web interface (icingaweb). We create them by running this:

sudo mysqladmin create icinga
sudo mysqladmin create icingaweb

Now we need to access MySQL to create the users, and give them permissions, which will deal with those databases:

mysql -u root -p

Alternatively, you might need to access MySQL with:

sudo mysql

With MySQL 8, shipped by default with Ubuntu 19.10, we cannot create and grant permissions on the same command as before, so we have to use a CREATE command and then a GRANT one. Also, when creating the user we need to specify the mysql_native_password authentication plugin because by default MySQL 8 uses auth_socket and most applications expect to log in with a password. Thus, these are the commands we need to run:

CREATE USER icinga@localhost IDENTIFIED WITH mysql_native_password BY '<password>';
CREATE USER icingaweb@locahost IDENTIFIED WITH mysql_native_password BY '<password>';
GRANT ALL PRIVILEGES ON icinga.* TO icinga@localhost;
GRANT ALL PRIVILEGES ON icingaweb.* TO icingaweb@localhost;

Install Icinga

sudo apt install icinga2 icingaweb2 icinga2-ido-mysql

Answer "no" to "Enable Icinga 2's ido-mysql feature?" and to "Configure database for icinga2-ido-mysql with dbconfig-common?". We'll do it later:

sudo icinga2 feature enable command
sudo icinga2 feature enable ido-mysql

Here we import the MySQL schema:

sudo mysql icinga < /usr/share/icinga2-ido-mysql/schema/mysql.sql

Now we need to configure the MySQL access by editing this file:

sudo nano /etc/icinga2/features-available/ido-mysql.conf

and fill in the ddbb credentials for icinga:

* The db_ido_mysql library implements IDO functionality * for MySQL.
library "db_ido_mysql"
object IdoMysqlConnection "ido-mysql" { 
 user = "icinga"
 password = "<password>"
 host = "localhost"
 database = "icinga" 

Finally, we restart icinga2:

sudo systemctl restart icinga2

We are almost done, but before accessing the web interface for icinga2, we need to create a token which will allow us to finish the web setup:

sudo icingacli setup token create

copy the token this last command provides you, go to http://<yourip>/icingaweb2 and fill in the token in the form you would have to get.

Now it's time to configure the web interface of icinga2. You only have to accept all the defaults and click next at every step, except on:

  • Database Resource: where you have to fill in with the icignaweb database credentials.
  • Administration: here you enter your desired username and password as admin of the web interface.
  • Monitoring IDO Resource: here you have to fill in the icinga database credentials.
  • Command Transport: need to select "Local command file" for the "Transport type".

After a few steps more, just clock on "finish" and icinga2 and icingaweb2 will be fully functional on your Ubuntu 19.10.

Please, add any comment down here  ?  with any doubts or suggestions you might have.

ubuntu English programari lliure
Llegiu això següent

Sobre la importància de triar un bon professor/a de cant

Fa trenta-cinc anys que intento aprendre a cantar. Al llarg de tots aquests anys he tingut, o he provat, un mínim de 12 professors o profess...

You might enjoy

How to set a Backdrop cms as backend and a Laravel as frontend

I document how I use a backdrop site as backend and a laravel as a front end for a web site, using a laravel package I wrote, backdrop headl...