HomeLinuxThe best way to Set up Icinga2 Monitoring Software on Ubuntu 20.04/22.04

The best way to Set up Icinga2 Monitoring Software on Ubuntu 20.04/22.04


Icinga2 is a robust free and open-source monitoring software that retains an eye fixed in your community sources and sends alerts or notifications in case of failure or outages. It additionally collects metrics from community sources that may allow you to generate efficiency knowledge and create reviews.

Icinga2 is scalable and it might probably monitor small to giant and sophisticated networks throughout varied areas. On this information, you’ll discover ways to set up the Icinga2 monitoring software on Ubuntu 20.04 and Ubuntu 22.04.

Step 1: Set up Apache, MariaDB, and PHP

We begin off by putting in Apache, MariaDB, and PHP with further PHP modules that are required in the course of the closing setup of Icinga2 on an online browser.

$ sudo apt set up apache2 mariadb-server mariadb-client mariadb-common php php-gd php-mbstring php-mysqlnd php-curl php-xml php-cli php-soap php-intl php-xmlrpc php-zip  php-common php-opcache php-gmp php-imagick php-pgsql -y

As soon as put in, ensure all of the companies are operating. If that’s the case, run the next instructions.

$ sudo systemctl begin {apache2,mariadb}
$ sudo systemctl allow {apache2,mariadb}
$ sudo systemctl standing {apache2,mariadb}

Subsequent, you should use mysql_secure_installation script to arrange the password for the database root account, take away nameless customers, disallow root login remotely and take away the check database.

$ sudo mysql_secure_installation

With the PHP modules in place, you should modify the php.ini file which is the default configuration file for functions operating on PHP.

Utilizing your most well-liked editor, open the file. Right here. we’re utilizing a nano command-line editor.

$ sudo nano /and so forth/php/8.1/apache2/php.ini   [On Ubuntu 22.04]
$ sudo nano /and so forth/php/7.4/apache2/php.ini   [On Ubuntu 20.04]

Make the next modifications to the next parameters.

memory_limit = 256M 
post_max_size = 64M
upload_max_filesize = 100M	
max_execution_time = 300
default_charset = "UTF-8"
date.timezone = "Asia/Kolkata"
cgi.fix_pathinfo=0

For the date.timezone parameter, be sure you set it as much as replicate your present time zone. Here’s a record of supported occasions zones by PHP.

To use the modifications made, merely restart the Apache webserver.

$ sudo systemctl restart apache2

Step 2: Set up Icinga2 on Ubuntu

With the PHP configuration out of the way in which, we’ll proceed and set up Icinga2. Nevertheless, the Icinga2 repository will not be offered by the Ubuntu 20.04 repositories. As such, we have to manually add the repository to your system.

Subsequently, begin off by including the GPG key utilizing the curl command.

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

Subsequent, create a repository file for Icinga2.

$ sudo vim /and so forth/apt/sources.record.d/icinga-focal.record

Add the next entries.

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

Save and exit the file.

To start out utilizing the repository, replace the package deal lists as follows.

$ sudo apt replace

Subsequent, set up Icinga2 and the monitoring plugins.

$ sudo apt set up icinga2 monitoring-plugins
Install Icinga2 on Ubuntu
Set up Icinga2 on Ubuntu

As soon as the set up is full, allow and begin the Icinga2 service.

$ sudo systemctl allow icinga2
$ sudo systemctl begin icinga2

To verify that the Icinga2 service is operating, execute:

$ sudo systemctl standing icinga2
Check Icinga2 on Ubuntu
Examine Icinga2 on Ubuntu

The output signifies that the Icinga2 daemon is operating and we’re good to go.

Step 3: Set up the Icinga2 IDO Module

The Icinga2 Information Output (IDO) exports all of the configuration and standing info right into a database. The IDO database is then utilized by Icinga Net 2 as a knowledge backend.

To put in the module, run the command

$ sudo apt set up icinga2-ido-mysql -y
Install Icinga2 IDO Module
Set up Icinga2 IDO Module

Alongside the way in which, a pop-up might be displayed on the terminal. To allow Icinga2’s ido-mysql function, choose ‘Sure‘ and press ENTER.

Configure ido-mysql Module
Configure ido-mysql Module

The icinga2-ido-mysql package deal requires a database put in and configured. This may be dealt with with dbconfig-common, however we’re going to create the database ourselves. So choose ‘No‘ and refuse this feature.

Configure ido-mysql Database
Configure ido-mysql Database

Subsequent, log in to your MariaDB database server.

$ sudo mysql -u root -p

Then, create a database and a database person for the icinga2-ido-mysql package deal and grant the person all of the privileges on the database.

> CREATE DATABASE icinga_ido_db;
> GRANT ALL ON icinga_ido_db.* TO 'icinga_ido_user'@'localhost' IDENTIFIED BY 'Password321';
> FLUSH PRIVILEGES;
> EXIT;
Create Icinga2 Database
Create Icinga2 Database

With the database in place, proceed and import the Icinga2 IDO schema utilizing the command. You may be required to offer the database server’s root password.

$ sudo mysql -u root -p icinga_ido_db < /usr/share/icinga2-ido-mysql/schema/mysql.sql

Step 4: Allow the Icinga2 IDO Module

To allow the icinga2-ido-mysql database communication with Icinga Net 2, we have to go a step additional and make modifications to the default configuration file.

Open the icinga2-ido-mysql configuration file.

$ sudo vim /and so forth/icinga2/features-available/ido-mysql.conf

Edit the next entries and set them to match the icinga2-ido-mysql database particulars as laid out in Step 3.

Enable Icinga MySQL Module
Allow Icinga MySQL Module

Save the modifications and exit.

Then allow the icinga2-ido-mysql function.

$ sudo icinga2 function allow ido-mysql

For the modifications to return into impact, restart Icinga2.

$ sudo systemctl restart icinga2 
Restart Icinga2 Service
Restart Icinga2 Service

Step 5: Set up and Setup IcingaWeb2

The final part to put in and configure is IcingaWeb 2, which is a quick, highly effective, and extensible PHP framework that acts because the entrance finish to Icinga2.

So set up IcingaWeb2 and the Icinga CLI, run the command.

$ sudo apt set up icingaweb2 icingacli -y
Install IcingaWeb2 in Ubuntu
Set up IcingaWeb2 in Ubuntu

We have to create a second database schema that might be designated for Icinga Net 2.

As soon as once more, log in to your database server.

$ sudo mysql -u root -p

Then create the database and database person for Icingaweb2 and grant all permissions to the database person on the database.

> CREATE DATABASE icingaweb2;
> GRANT ALL ON icingaweb2.* TO 'icingaweb2user'@'localhost' IDENTIFIED BY '[email protected]';
> FLUSH PRIVILEGES;
> EXIT;
Create Icingaweb2 Database
Create Icingaweb2 Database

Thereafter, create a setup token utilizing the next command. The setup token might be used throughout authentication when organising Icinga2 on the browser.

$ sudo icingacli setup token create
Create Icingaweb2 Token
Create Icingaweb2 Token

In case you lose or overlook the token, you’ll be able to view it by operating the command:

$ sudo icingacli setup token present
View Icingaweb2 Token
View Icingaweb2 Token

Step 6: Full IcingaWeb2 Set up in Ubuntu

With all configurations in place, we’ll now full the Icinga2 arrange on an online browser. So, launch your browser and head over to the URL proven.

http://server-ip/icingaweb2/setup

This takes you to the Welcome web page as proven. Bear in mind the setup token that you just created? Copy and Paste it within the textual content discipline and click on ‘Subsequent’.

Add Icingaweb2 Token
Add Icingaweb2 Token

On the ‘Modules‘ web page, the ‘Monitoring’ module is enabled by default. Nevertheless, you might be at liberty to allow your most well-liked modules.

Icingaweb2 Modules
Icingaweb2 Modules

Then scroll down and click on ‘Subsequent‘.

Within the subsequent step, make sure that all of the PHP modules and libraries are put in and listing permissions are appropriate.

Icingaweb2 PHP Modules
Icingaweb2 PHP Modules

Then scroll down and click on ‘Subsequent‘.

On the ‘Authentication’ web page, choose ‘Database’ because the authentication kind and click on ‘Subsequent’.

Icingaweb2 Database Authentication
Icingaweb2 Database Authentication

Within the ‘Database Useful resource’ part, fill within the database particulars for IcingaWeb2 as laid out in Step 5.

Icingaweb2 Database Resource
Icingaweb2 Database Useful resource

Then scroll down and click on ‘Validate Configuration’ to validate the database particulars.

Icingaweb2 Validate Configuration
Icingaweb2 Validate Configuration

If all went properly, the database configuration might be efficiently validated. As soon as the validation is profitable, scroll down and click on ‘Subsequent’.

Icingaweb2 Validate Confirmation
Icingaweb2 Validate Affirmation

Within the subsequent step, click on ‘Subsequent’ to simply accept the defaults.

Icingaweb2 Backend Name
Icingaweb2 Backend Title

Within the ‘Software Configuration’ part, click on ‘Subsequent’ to simply accept the defaults.

Icingaweb2 Application Configuration
Icingaweb2 Software Configuration

Within the subsequent step, take a while and assessment all of the modifications for Icinga Net 2. Be certain that all of the configurations are appropriate and be happy to return and make the mandatory corrections.

Icingaweb2 Configuration Summary
Icingaweb2 Configuration Abstract

If all seems to be good, scroll down and click on ‘Subsequent‘.

The final part within the Icinga2 net setup entails configuring the monitoring module. So, click on ‘Subsequent’.

Icingaweb2 Monitoring Modules
Icingaweb2 Monitoring Modules

Subsequent, fill within the database particulars for the Icinga2 IDO module as laid out in Step 3.

Icinga2 IDO Database Module
Icinga2 IDO Database Module

Then scroll down and click on ‘Validate Configuration’.

Icinga2 IDO Validate Configuration
Icinga2 IDO Validate Configuration

As soon as once more, the validation of the database particulars must be successful. If you happen to get an error, head again and guarantee all the small print are appropriate.

Icinga2 IDO Validate Confirmation
Icinga2 IDO Validate Affirmation

To move to the subsequent step, scroll down and click on ‘Subsequent’.

Within the ‘Command Transport’ part, choose ‘Native Command File’ because the transport kind and click on ‘Subsequent’.

Icingaweb2 Command Transport
Icingaweb2 Command Transport

Within the ‘Monitoring Safety’ part, merely click on ‘Subsequent’ to go together with the defaults.

Icingaweb2 Monitoring Security
Icingaweb2 Monitoring Safety

Evaluation all of the modifications for the monitoring module. If something seems to be misplaced, head again and make the mandatory corrections.

Confirm IcingaWeb2 Monitoring Configurations
Verify IcingaWeb2 Monitoring Configurations

Then scroll down and click on ‘End’.

At this level, Icinga Net 2 has efficiently been arrange and it’s best to see a notification to that impact as proven beneath. To log in to the Icinga2 dashboard, click on on ‘Login to Icinga Net 2’.

Icingaweb2 User Login
Icingaweb2 Person Login

This takes you to the login web page as proven. Present your Admin account particulars and press ENTER to log in.

Icingaweb2 Admin Login
Icingaweb2 Admin Login

And the Icinga2 dashboard will become visible. Any present points might be displayed with their stage of severity. For instance, the dashboard notifies us of 28 packages with prepared upgrades.

Icingaweb2 Dashboard
Icingaweb2 Dashboard

To confirm this, we’ll head again to the terminal and run the command:

$ sudo apt record --upgradable
List Upgradable Packages
Listing Upgradable Packages

To improve the packages, we’ll merely run:

$ sudo apt improve -y

And this resolves the difficulty. From the dashboard, you’ll be able to see that there are not any extra points displayed.

Icingaweb2 Dashboard Summary
Icingaweb2 Dashboard Abstract

On this information, we have now demonstrated methods to set up the Icinga2 monitoring software on Ubuntu. Admittedly, the set up is sort of lengthy and requires consideration to element. Nonetheless, in the event you adopted the steps to the latter, every part ought to work simply superb.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments