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

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.

  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.

  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.

  1. Configure Monitoring Security and Administration.

  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.

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

$1.79 /mo
Starting price
Visit HostArmada
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.5
  • Features
    4.5
  • Reliability
    4.5
  • Pricing
    4.0
$1.00 /mo
Starting price
Visit IONOS
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.0
  • Features
    4.5
  • Reliability
    4.5
  • Pricing
    4.3
$2.90 /mo
Starting price
Visit Ultahost
Rating based on expert review

How to Install Own Cloud On an an Ubuntu 18.04 Dedicated Server or VPS

You can create your own self-hosted cloud storage services by installing the ope
3 min read
Idan Cohen
Idan Cohen
Marketing Expert

How to Enable Two-Factor Authentication on an Ubuntu 18.04 VPS or Dedicated Server

This guide will show you how you enable two-factor authentication to improve the
4 min read
Max Ostryzhko
Max Ostryzhko
Senior Web Developer, HostAdvice CTO

How to Install a Let’s Encrypt Certificate on your Ubuntu 18.04 Dedicated Server or VPS

If you are hosting your website on a VPS server running Ubuntu 18.04, we will sh
3 min read
Michael Levanduski
Michael Levanduski
Expert Hosting Writer & Tester

How to install OpenLiteSpeed on an Ubuntu 18.04 VPS or Dedicated Server

OpenLiteSpeed is an open source web server characterized by high-performance, li
3 min read
Kennedy Mbuvi
Kennedy Mbuvi
Author
HostAdvice.com provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.
Click to go to the top of the page
Go To Top