How to Install Icinga2 Monitoring Tool on Debian

Originally created as a fork of the Nagios monitoring tool, Icinga is a free and open-source infrastructure monitoring and alerting solution that monitors your entire infrastructure and provides feedback about the availability and performance of your devices.

It also allows you to collect, store and visualize various metrics. You can then create reports using the data collected and visualizations that have been populated.

Icinga also sends alerts or notifications in case something goes wrong so that you can promptly attend to the issues and restore services in the least possible amount of time.

In this guide, we will walk you through the installation of the Icinga2 Monitoring tool on Debian 11/10.

Prerequisites

To successfully install Icinga2, be sure to have the LAMP stack installed. We already have a guide on how to install LAMP on Debian 10/11. Once you have all the components of LAMP in place, head over to the following steps.

Step 1: Install PHP Modules in Debian

Some additional PHP modules are required for the installation to proceed smoothly. Therefore, on your terminal, run the following command to install them.

$ sudo apt install 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

Next, edit the PHP ini file.

$ sudo nano /etc/php/7.4/apache2/php.ini

Make the following changes.

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, set it to reflect your current time zone. Here is the list of supported time zones.

Save the changes and exit the file and then restart Apache to apply the changes.

$ sudo systemctl restart apache2

Step 2: Install Icinga2 in Debian

To install Icinga2 and the associated monitoring plugins, first, update the package lists:

$ sudo apt update -y

Then run the following command:

$ sudo apt install icinga2 monitoring-plugins -y

Once the installation is complete, start and enable Icinga2 to start on boot time.

$ sudo systemctl start icinga2
$ sudo systemctl enable icinga2

You can verify that Icinga2 is running as follows:

$ sudo systemctl status icinga2
Check Icinga Status
Check Icinga Status

From the output, you can see that the Icinga2 daemon is running, which is great!

Step 3: Install Icinga2 IDO MySQL Module

Icinga IDO (Icinga Data Output) is a key feature that exports all configuration and status information into the IDO database. The IDO database sits at the backend and serves Icinga Web 2.

To install the Icinga IDO MySQL module run the command:

$ sudo apt install icinga2-ido-mysql -y

This takes you through a couple of prompts to configure the icinga2-ido-mysql module. When prompted to enable the icinga2-ido-mysql feature, select ‘Yes‘ and press ENTER.

Configure Icinga2 IDO Mysql Module
Configure Icinga2 IDO Mysql Module

The Icinga-ido-mysql module requires a database to be installed and configured before it can be used. Usually, this can be handled using dbconfig-common which is a tool that simplifies database management.

For simplicity, select to automatically configure the database for icinga2-ido-mysql using dbconfig-common by selecting ‘Yes’ and pressing ENTER.

Configure Database for Icinga2-ido-mysql
Configure Database for Icinga2-ido-mysql

Next, provide a password for icinga2-ido-mysql to connect with the database server and confirm it.

Connect Database for icinga2-ido-mysql Module
Connect Database for icinga2-ido-mysql Module

Step 4: Create a Database for Icinga-IDO MySQL Module

Next, we need to manually create the database for the icinga2-ido-mysql monitoring module.

So, log in to the MySQL prompt.

$ sudo mysql -u root -p

Create the database and database user for icinga2-ido-mysql and then grant all the privileges to the database user of the database.

Feel free to use any arbitrary name for the database and database user.

> CREATE DATABASE icinga_ido_db;
> GRANT ALL ON icinga_ido_db.* TO 'icinga_ido_user'@'localhost' IDENTIFIED BY 'Password321';
> FLUSH PRIVILEGES;
> EXIT;
Create Database for Icinga-IDO-MySQL Module
Create Database for Icinga-IDO-MySQL Module

Next, import the Icinga2 IDO schema as follows. Provide the MySQL root password once prompted.

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

Step 5: Enable Icinga-IDO MySQL Module

The IDO MySQL package has a default configuration file known as ido-mysql.conf. We need to make a few changes to allow connection to the database that we have just created.

So, open the configuration file.

$ sudo vim /etc/icinga2/features-available/ido-mysql.conf

Scroll and navigate to this section and provide the database details.

Icinga-IDO-MySQL Database Settings
Icinga-IDO-MySQL Database Settings

Save the changes and exit the configuration file. Next, enable the ido-mysql module as follows.

$ sudo icinga2 feature enable ido-mysql

To apply the changes, restart Icinga2:

$ sudo systemctl restart icinga2

Step 6: Install IcingaWeb2 on Debian

Next, we are going to install and configure the IcingaWeb2, which is a simple, intuitive, and responsive web interface for Icinga.

First, we will install IcingaWeb2 along with the Icinga CLI as follows:

$ sudo apt install icingaweb2 icingacli -y

Once the installation is complete, create a database for Icinga Web 2.

$ sudo mysql -u root -p

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

> CREATE DATABASE icingaweb2;
> GRANT ALL ON icingaweb2.* TO 'icingaweb2user'@'localhost' IDENTIFIED BY 'P@ssword';
> FLUSH PRIVILEGES;
> EXIT;
Create Database IcingaWeb2
Create Database IcingaWeb2

Next, create a secret token that will be used for authentication when completing the setup on a web browser.

$ sudo icingacli setup token create
Create Token for Icinga
Create Token for Icinga

Note down the token and paste it somewhere safe as it will be required when completing the Icinga2 setup on the browser.

Step 7: Complete IcingaWeb2 Installation

The last step in installing Icinga is finalizing the setup on a browser. So, launch your browser and head over to the URL shown.

http://server-ip/icingaweb2/setup

This takes you to this page where you will be required to authenticate with the security token that you generated in the previous step. Paste the security token and click ‘Next’.

Setup Token for Icinga
Setup Token for Icinga

The next step displays all the modules that can be enabled. The monitoring module is enabled by default. You can enable additional modules as you deem fit.

Icinga Modules
Icinga Modules

The next page is basically a checklist of all the php modules which need to be enabled. Ensure that all the required php modules have been installed and no errors are displayed. Then scroll down and click ‘Next’ to move to the next step.

Check PHP Modules for Icinga
Check PHP Modules for Icinga

For authentication, select ‘Database‘ and click ‘Next‘.

Choose Authentication for Icinga
Choose Authentication for Icinga

In the next step, fill in the database details for IcingaWeb2 that you specified in Step 6.

IcingaWeb2 Database Settings
IcingaWeb2 Database Settings

Scroll down and click ‘Validate configuration’.

IcingaWeb2 Validation
IcingaWeb2 Validation

If the details are correct, you should get a notification that all went well. Scroll down and click ‘Next’.

IcingaWeb2 Validation Successful
IcingaWeb2 Validation Successful

In the next step, simply click ‘Next’ to accept the default setting and proceed with the installation.

Choose IcingaWeb2 Backend
Choose IcingaWeb2 Backend

Next, configure an Admin account for the user that you will use to log in to the Icinga2 WebUI.

IcingaWeb2 Admin
IcingaWeb2 Admin

In the next step, simply click ‘Next’ to accept the default Application configuration details.

Choose IcingaWeb2 Application Configuration
Choose IcingaWeb2 Application Configuration

At this stage, the Icinga Web 2 has successfully been configured. Review the configuration details and ensure that everything is correctly set. Then scroll down and click ‘Next’.

IcingaWeb2 Configuration Review
IcingaWeb2 Configuration Review

The next section walks you through the configuration of the Icinga monitoring module for Icinga Web 2. This is the core module that provides status and reporting views with robust filtering capabilities.

To get started, click ‘Next’.

Icinga Monitoring Module
Icinga Monitoring Module

Select ‘IDO’ as the monitoring Backend Type and click ‘Next’.

Choose Icinga Monitoring Module Backend
Choose Icinga Monitoring Module Backend

Next, provide the database details for the icinga-ido-mysql monitoring module as specified in Step 4.

Icinga-IDO-Mysql Database Settings
Icinga-IDO-Mysql Database Settings

Scroll all the way down and click ‘Validate configuration’. If the connection details are correct, you should get a notification that the configuration was successfully validated.

Icinga IDO Module Validation Successful
Icinga IDO Module Validation Successful

To proceed to the next step, scroll down and click ‘Next’. In the ‘Command Transport’ section, select ‘local Command File’ as the Transport Type. and click ‘Next’.

Choose Command Transport
Choose Command Transport

In the ‘Monitoring Security’ section, accept the defaults by pressing ‘Next’.

Choose Monitoring Security
Choose Monitoring Security

Review all the configuration details for the monitoring module and ensure everything is right. Then scroll down and click ‘Finish’.

Monitoring Module Review
Monitoring Module Review

You should get a notification that Icinga Web 2 has successfully been set up. To login to the WebUI, click on the ‘Login to Icinga Web 2’ button.

Login to Icinga Web2
Login to Icinga Web2

The login page will appear as shown. Provide the Icinga admin credentials and click on the ‘Login’ button.

Icinga Admin Login
Icinga Admin Login

This ushers you to the Icinga dashboard as shown. Any existing issues will the displayed. For example, you can see that we have 6 packages with pending upgrades.

Icinga Dashboard
Icinga Dashboard

To confirm this, we will head over to the terminal and list the packages with pending upgrades.

$ sudo apt list --upgradable
List Upgradable Packages
List Upgradable Packages

From the output, we can confirm that, indeed, 6 packages have upgrades. To upgrade these packages, we will simply run:

$ sudo apt upgrade -y

And that wraps up our guide today. As you have noted, the installation is quite long and requires a lot of attention to detail. Nonetheless, everything should go well if you carefully follow the steps to the latter.

In this guide, we have demonstrated how to install the Icinga2 monitoring tool on Debian 11/10.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

James Kiarie
This is James, a certified Linux administrator and a tech enthusiast who loves keeping in touch with emerging trends in the tech world. When I'm not running commands on the terminal, I'm taking listening to some cool music. taking a casual stroll or watching a nice movie.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.