How to Install and Configuring Icinga2 Monitoring Tool on an Ubuntu 18.04 VPS or Dedicated Server

Icinga2 is an open source, scalable and extensible computer system and network monitoring application. You can use it to check the availability of your network, along with generating performance reports.

You can also use it to inform the users about the outages. In addition, you can monitor server resources, like RAM usage, network services, like HTTPS, and network devices, like routers and switches. In this article, you will find the step by step guide for installing and configuring Icinga2 on 18.04 VPS or dedicated server.

Installing Icinga2 on 18.04 VPS or Dedicated Server

  1. Update the system and get the latest packages by using the following command:
sudo apt-get update
sudo apt-getupgrade
sudo reboot
  1. Install web server and PHP by typing these lines:
sudo apt-get install php php-{xml,cli,opcache,gd,intl,readline,mysql,curl,mbstring,ldap,json}
  1. Install apache2 and libapache2-mod-php module
sudo apt-get install apache2 libapache2-mod-php
  1. Configure PHP Timezone by typing these lines:
$ sudo vim /etc/php/7.2/apache2/php.ini
date.timezone = Africa/Nairobi
  1. Now, restart apache2 service.
sudo systemctl restart apache2
  1. Download and install MariaDB database on your Ubuntu 18.04 VPS by following the instructions mentioned here.
  2. Sign into the database as the root user.
$ mysql -u root -p
  1. Create a database and a user.
CREATEDATABASE icinga2_db;
GRANT ALL PRIVILEGESon icinga2_db.* to'icinga2_user'@'localhost'identifiedby'StrongPassword';
FLUSHPRIVILEGES;
quit
  1. Now, create another database and user for Icinga web 2.
CREATEDATABASE icingaweb2_db;
GRANT ALL PRIVILEGESon icingaweb2_db.* to'icingaweb2_user'@'localhost'identifiedby'StrongPassword';
FLUSHPRIVILEGES;
  1. Import repo GPG key:
curl -sSL https://packages.icinga.com/icinga.key | sudo apt-key add -
  1.  Add apt repository using the following command:
echo"deb https://packages.icinga.com/ubuntu icinga-xenial main" | sudo tee /etc/apt/sources.list.d/icinga.list
  1.  Install Icinga2 packages.
sudo apt-get install icinga2 icingaweb2 icinga2-ido-mysql
  1.  If you are asked to enable Icinga2 for using MySQL, reply YES.
EnableIcinga2's ido-mysql feature? YES
Configure database for icinga2-ido-mysql with dbconfig-common? NO
  1. Activate ido-mysql and command features by typing this line:
sudo icinga2 feature enablecommand  ido-mysql
  1. Restart Icinga2.
sudosystemctlrestarticinga2.service
  1. Import database schema by using this command:
mysql -u root icinga2_db -p < /usr/share/icinga2-ido-mysql/schema/mysql.sql
  1. Configure Icinga2 MySQL IDO.
sudo vim /etc/icinga2/features-enabled/ido-mysql.conf
  1. Type these lines:
/**
 * The db_ido_mysql library implements IDO functionality
 * for MySQL.
 */

library"db_ido_mysql"

object IdoMysqlConnection "ido-mysql" {
  user = "icinga2_user",
  password = "StrongPassword",
  host = "localhost",
  database = "icinga2_db"
}
  1. Save the changes and restart Icinga2 server.
sudo systemctl restart icinga2

Configuring Icinga 2 on Web Interface

  1.  Create a setup token.
$ sudo icingacli setup token create
The newly generated setup token is: 75e269c261a15615
  1. Open your favorite browser and go to http://serverdomain/icingaweb2.
  2. The configuration wizard page will be displayed. Copy and paste the generated setup token from Step 1. Then click Next.

How to Install and Configuring Icinga2 Monitoring Tool on an Ubuntu 18.04 VPS or Dedicated Server

  1. Select your desired module. Click Next.
  2. A new page will appear. Ensure that all the PHP modules have been installed correctly.
  3. Now, select your desired authentication type, which is being set to MySQL by default.
  4. Insert your MySQL database settings.

How to Install and Configuring Icinga2 Monitoring Tool on an Ubuntu 18.04 VPS or Dedicated Server

  1. A page related to monitoring IDO Resource will be displayed. Use the Icinga2 settings that you had configured earlier.
  2. Insert Transport Name, Transport Type and Command File.

How to Install and Configuring Icinga2 Monitoring Tool on an Ubuntu 18.04 VPS or Dedicated Server

  1. Configure Monitoring Security and Administration.

How to Install and Configuring Icinga2 Monitoring Tool on an Ubuntu 18.04 VPS or Dedicated Server

  1. Get into the login page. Insert the admin account username and password. If you are able to sign in, then the configuration of Icinga2 is completed successfully.

How to Install and Configuring Icinga2 Monitoring Tool on an Ubuntu 18.04 VPS or Dedicated Server

Conclusion

In this article, you have learnt about installing Icinga 2 on Ubuntu 18.04 VPS or dedicated server. You have also learned to configure the monitoring tool appropriately. Now, you have the power to monitor massive and complex environments across different locations effectively.

Check out these top 3 Linux hosting services

Was this article helpful?