Install the Icinga2 monitoring tool on Ubuntu 20.04 and seamlessly examine all your network resources. From collecting metrics to generating performance reports, this tool can help you deal with a number of things quickly.
Icinga2 is a powerful modern-day utility that makes monitoring small to even complex networks an easy task. It is an open-source tool with which you can administer network resources at your convenience. In this write-up, you’ll learn how to install Icinga2 and get started with the monitoring process.
Pre Requisites
Before you install Icinga2 Monitoring tool on Ubuntu 20.04, you’ll need to get some other utilities ready on your system. These are MariaDB, Apache, and also the PHP. Remember, these tools play a significant role in the final setup of Icinga2.
Installing the Requisites
Installing these tools is no big deal. Simply launch the Terminal by using the “Ctrl+Alt+T” combination, followed by running the following command:
Input:

Verify the Running Status
Once you’re done with the installation part, the next task is checking whether the services are active or not. To do that, invoke the start, enable, and status commands. Study the respective outputs and proceed accordingly.
Installing Icinga2 Monitoring Tool on Ubuntu 20.04
Now that you’ve got your system prepared, you can start with the installation process. Follow the steps below and get the job done without any hold up.
Step 1: Securing the Database
Setting up the password and securing the database root account is very crucial. You should also remove all the available anonymous users, eliminate the test database, and disallow remote root login. For that, run the mysql
secure installation
command in the following manner:
$ sudo mysql_secure_installation

Step 2: Modifying the PHP
Having the PHP utility installed isn’t enough, as you’ll need to modify the modules. Use any desired editor like vim or nano and launch the php.ini file. The following command should look like this:
$ sudo nano/vim /[directory]php.ini

Once you’re inside the file, make sure to locate the date.timezone column and set the parameter as your current time zone.
Step 3: Restart Apache Server
To ensure that the changes are successfully applied, head over and restart your Apache web server. Input the following command:
$ sudo systemctl restart apache2
Step 4: Install the Icinga2 Monitoring Tool on Ubuntu 20.04
Remember, the Icinga2 repository isn’t available on Ubuntu 20.04 by default. And adopting the manual approach is the only way to do it.
Add GPG Key
Use the curl command and start adding the GPG key.
Input:
$ curl https://packages.icignia.com/icignia.key | apt-key add -

Creating a Repository
After adding the GPG key, the next step is to create a repository for Icinga2.
Input:
$ sudo vim [directory] /etc/apt/sources.list.d/icinga-focal.list
Once inside, add the following entries:

Once done, save the file and exit.
Update the System Repository
Like any other case, updating the system repository using the apt update
command is always a good idea. The steps are no different with Icinga2.
Input:
$ sudo apt update
Install Icinga2
Finally, you can now install the Icinga2 monitoring tool on Ubuntu 20.04 using the sudo apt install command.
Input:

Step 5: Enable and Start the Icinga2 Monitoring Tool
Pass the systemctl enable and the systemctl start command to initiate the Icinga monitoring tool post-installation. After that, use the status option and the sudo systemctl command to verify if the services are running correctly.
At this point, you should already know how to install the Icinga2 monitoring tool on Ubuntu 20.04. However, that’s not enough. You also need to install a couple of more utilities to ensure that you won’t run into any issues in the long run.
Installing the Icinga2 IDO Module
With IDO, aka Icinga Data Output, you’re looking at a module that helps export all the existing configuration and the underlying status information into a specific database. To install the utility, simply run the following command:
$ sudo apt install icinga-ido-mysql -y

Accept the authentication promotes that will pop up, and you’re done.
It is crucial to remember that the icinga-ido-mysql package
installation process will also ask for authenticating a dedicated database installation. Make sure you refuse it, as we’ll be creating one ourselves in the next step.
Creating the Required Database
First, get yourself logged into the MariaDB database. From there, you can build the required database and grant all the desired privileges.
Input:
$ sudo mysql -u root -p

Enabling the IDO Module
Enabling the IDO is a bit complicated as you’ll need to alter the default configuration file. Use any editor like vim, launch the file, and make the required changes.
Input:
$ sudo vim [directory]ido-mysql.conf
Look for the database entries and modify the values according to the ones you’ve set earlier. After that, save your changes and exit.
Enable the IDO MySQL Feature
To enable the Icinga IDO MYSQL feature, run the following command inside the Terminal:
$ sudo lcinga feature enable ido-mysql

Restart the Icinga tool and make sure the changes were made.
Input:
$ sudo systemctl restart icinga2
And there you have it, the complete guide on how to install the Icinga2 monitoring tool on Ubuntu 20.04. In this article, we’ve walked you through the entire process in the most easy-to-digest manner. We hope you dedicated your attention to reading this piece, so you’ll understand how to properly use Icinga.
If this guide helped you, please share it.