How to Install & Configure Icinga 2 Monitoring Tool on ubuntu 20.04

Icinga is a open-source monitoring tool.It is used for data center & checks the availability of network & system resources.Icinga 2 is a updated version of Icinga.

Icinga is system & network monitoring application tool & checks the resources performance and provides the high-availability and distributed monitoring setup.

 

Install Apache2 Web Service

Update the System.

apt-get update

Install apche2 web service.

apt-get install apache2

Start & Enable Apache2 service.

systemctl start apache2
systemctl enable apache2

Install PHP8.0

Update the system

apt-get update

Enable PHP PPA repository

add-apt-repository ppa:ondrej/php 

Install PHP8.0

apt-get install php8.0 

Installing PHP Extensions

apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip
apt-get install php-cli php-mysql php8.0-common php8.0-opcache php-gmp php-imagick

Check PHP version.

php -v

Configure the php.ini.

vim /etc/php/8.0/apache2/php.ini

Update the following values:

date.timezone = Asia/Kolkata
cgi.fix_pathinfo=0 

Restart the Apache2 service.

systemctl restart apache2

Install the Icinga2

Add the icinga2 repository & GPG key.

curl https://packages.icinga.com/icinga.key | apt-key add -

Go to Source directory.

cd /etc/apt/sources.list.d

Create a repository file.

vim icinga-focal.list

Add the given below lines.

deb http://packages.icinga.com/ubuntu icinga-focal main
deb-src http://packages.icinga.com/ubuntu icinga-focal main

Update the packages.

apt-get update

Install the Icinga2 and Nagios Monitoring Plugins.

apt-get install icinga2 monitoring-plugins

Start & Enable the Icinga2 service.

systemctl start icinga2
systemctl enable icinga2

Check the status of the Icinga2 service.

systemctl status icinga2

Here is the command output.

● icinga2.service - Icinga host/service/network monitoring system
   Loaded: loaded(/lib/systemd/system/icinga2.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/icinga2.service.d
             └─limits.conf
     Active: active (running) ; 58min ago
   Main PID: 22352 (icinga2)
      Tasks: 18
     Memory: 46.2M

Install MySQL Database Server

Update the System.

apt-get update

Install Mysql database.

apt-get install mysql-server mysql-client

Start & Enable Mysql service.

systemctl start mysql
systemctl enable mysql

Install and Configure Icinga2 MySQL Module.

apt-get install icinga2-ido-mysql

Here is the command output.

  • Select Yes to enable the Icinga 2’s ido-mysql feature.

 

Fig 1

 

  • Select yes,configure the databse for ‘icinga2-ido-mysql’ with dbconfig-command.

 

Fig 2

 

  • Provide the mysql application password for Icinga2-ido-mysql.

 

Fig. 3

 

  • Confirm the password.
  • Click ok.

 

Fig. 5

 

Login to MySQL database.

mysql -u root

Press Enter.

Here is the command output.

Fig 1

Modify the user ‘icinga2@localhost’ identified with the native MySQL authentication plugin.

ALTER USER icinga2@localhost IDENTIFIED WITH mysql_native_password BY 'password';
flush privileges;
Exit;

Enable the ‘ido-mysql’ .

icinga2 feature enable ido-mysql
icinga2 feature list

Here is the command output.

root@ip-172-31-26-69:/home/ubuntu# icinga2 feature enable ido-mysql
Enabling feature ido-mysql.Restart Icinga2 for these changes to take effect

root@ip-172-31-26-69:/home/ubuntu/# icinga2 feature list
Disabled features: api command compatlog debuglog 
elasticsearch gelf graphite icingadb influxdb livestatus opentsdb syslog
Enabled features: checker ido-mysql mainlog notification

Restart the icinga2 service.

systemctl restart icinga2

Install Icingaweb2

apt-get install icingaweb2 icingacli

Again,Login to Mysql database.

mysql -u root

Press Enter.

Here is the command output.

Fig 1

Create MySQL user & set the password.

create user icingaweb2@localhost identified with mysql_native_password by "password1";

Create Database.

create database icingaweb2;

Provide Grant  all privileges on database to icingaweb2@localhost with grant option;

grant all privileges on icingaweb2.* to icingaweb2@localhost with grant option;

Flush the privileges.

FLUSH PRIVILEGES;

Generate the icingaweb2 token.

icingacli setup token create

Here is the command output.

Copy the generated token.

The newly generated setup token is: b7216e39546855b4

Access Icinga 2 and Icingaweb 2 web-interface

http://server-ip/icingaweb2/setup 

Here is the output.

  • Paste the generated token number.
  • Click on Next.

 

Fig 1

 

  • We have multiple Icinga modules for installation.Choose Monitoring.
  • Click on Next.

 

Fig 2

 

  • Check the Icinga environment.

 

Fig. 3

 

  • Click on Next.

 

Fig. 5

 

  • By default,authentication type is database.
  • Click on Next.

 

Fig. 5

 

  • Provide the database details for the icingaweb2.
  • Click on Validate Configuration.

 

Fig. 4

 

  • The Configuration has been successfully validated.
  • Click on Next.

 

Fig 2

 

  • Select Backend Name Icinfweb2.
  • Click on Next.

 

Fig 17

 

  • Provide the user-name & password for Icinga Web 2.
  • Click on Next.

 

Fig. 7

 

  • Leave it as default.
  • Click on Next.

 

Fig 2

 

  • Check & Confirm all configurations.
  • Click on Next.

 

Fig. 5

 

  • Now we get the icingaweb2 welcome page.
  • Click on Next.

 

Fig. 3

 

  • Select Backend Name icinga.
  • Select Backend Type IDO.
  • Click on Next.

 

Fig 2

 

  • Provide the database details for icinga2.
  • Click on Validate configuration.

 

Fig. 5

 

  • The configuration has been validated successfully.
  • Click on Next.

 

Fig. 4

 

  • Select Transport Type.

 

Fig. 3

 

  • Choose Local Command Line as a Transport Type.
  • Click on Next.

 

Fig 10

 

  • Click on Next.

 

Fig 11

 

  • Check & Confirm all configurations.
  • Click on Finish.

 

Fig 12

 

  • Icinga Web2 has been successfully setup.
  • Click on Login to Icinga Web 2.

 

Fig. 4

 

  • Provide the user-name & password of Icinga Web2.

 

Fig. 13

 

  • Now Icinga is Ready.

 

Fig 15

 

Leave a Reply