Icinga: UBUNTU 20.04 instalsi Icinga2

From OnnoCenterWiki
Jump to: navigation, search

Sumber: https://computingforgeeks.com/how-to-install-icinga2-monitoring-tool-on-ubuntu-18-04-lts/

Icinga 2 is an open source, scalable and extensible monitoring tool which checks the availability of your network resources, notifies users of outages, and generates performance data for reporting. Icinga 2 can monitor large, complex environments across multiple locations and has a web interface called Icinga Web 2

With Icinga 2 you can monitor:

   Server resources – RAM usage, CPU load, disk usage
   Network services –  HTTP, HTTPS, SMTP, IMAP, POP3, NNTP, ping e.t.c
   Network devices – Routers and switches

Features of Icinga 2

These are the top features which Icinga 2 provides:

   Performance-oriented: Icinga 2 has a multithreaded design, it can run thousands of checks each second without any sign of CPU strain.
   Distributed Architecture: IFor large and complex environments do a distributed setup with high availability.
   REST API: Icinga 2 provides a RESTful API which enables you to update your configurations on the fly or show live information about current problems on your custom dashboards.
   Rule-based Configuration: Monitoring as code with dynamic configurations. Apply rules to hosts and services to create a continuous monitoring environment.
   Alerting: You get instant notifications when problems occur via email, text message or mobile message applications.
   Icinga 2 has native support for  Graphite and InfluxDB. You can easily send performance data gathered directly to the third party tools.
   Icinga 2 supportNagiosGrapher, PNP4Nagios, and InGraph addons

Install Icinga2 on Ubuntu 18.04 LTS

With the introduction and features covered, let’s start the actual installation of Icinga2 on Ubuntu 18.04 LTS server. Step 1: Update your system

Run the commands below to update your system and get the latest packages

sudo apt-get update sudo apt-get upgrade sudo reboot

Step 2: Install Apache and PHP

Icinga 2 needs a web server and PHP installed on the hosting server. Run below commands to have everything setup.

sudo apt-get install php php-{xml,cli,opcache,gd,intl,readline,mysql,curl,mbstring,ldap,json}

Install apache2 and libapache2-mod-php module.

sudo apt-get install apache2 libapache2-mod-php

Configure php timezone

$ sudo vim /etc/php/7.2/apache2/php.ini date.timezone = Africa/Nairobi

Restart apache2 service

sudo systemctl restart apache2

Step 3: Install and Configure the MariaDB database server

Install MariaDB database on your Ubuntu 18.04 server using the link:

Install MariaDB 10.3 on Ubuntu 18.04 and CentOS 7

Once done with the installation, log in to the database as root user and create database and user.

$ mysql -u root -p

Create a database and user

CREATE DATABASE icinga2_db; GRANT ALL PRIVILEGES on icinga2_db.* to 'icinga2_user'@'localhost' identified by 'StrongPassword'; FLUSH PRIVILEGES; quit

Also, do the same for Icinga web 2.

CREATE DATABASE icingaweb2_db; GRANT ALL PRIVILEGES on icingaweb2_db.* to 'icingaweb2_user'@'localhost' identified by 'StrongPassword'; FLUSH PRIVILEGES;

Step 4: Install Icinga2 and Icinga Web 2

Start by importing repo GPG key:

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

Add apt repository

echo "deb https://packages.icinga.com/ubuntu icinga-bionic main" | sudo tee /etc/apt/sources.list.d/icinga.list

Run update of package list and install Icinga2 packages

sudo apt-get install icinga2 icingaweb2 icinga2-ido-mysql

Answer yes when asked whether Icinga 2 should use MySQL

Enable Icinga 2's ido-mysql feature? YES Configure database for icinga2-ido-mysql with dbconfig-common? NO

Configure Icinga 2 Backend

When done, enable ido-mysql and command features.

sudo icinga2 feature enable command ido-mysql

Then restart icinga2 after making the change

sudo systemctl restart icinga2.service

Import database schema:

mysql -u root icinga2_db -p < /usr/share/icinga2-ido-mysql/schema/mysql.sql

Configure Icinga2 MySQL IDO with created database and user account

sudo vim /etc/icinga2/features-enabled/ido-mysql.conf

Make changes like below:


* 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"


Restart icinga2 service after saving the changes

sudo systemctl restart icinga2

Configure Icinga2 on Web Interface

You need to create a setup token for use on web configuration

$ sudo icingacli setup token create The newly generated setup token is: 75e269c261a15615

Take note of the given token ID. On your web browser, open and the URL:

http://serverdomain/icingaweb2 or http://server-ip-address/icingaweb2

This should take you to configuration wizard page

   Provide generated token ID and click Next. 
   On the next page, select modules you want to enable and click Next.
   The next page will do a check if all PHP modules are installed.
   On the next page, select Authentication type, the default is MySQL
   Provide MySQL database settings
   On Monitoring IDO Resource page, provide Icinga2 database settings configured earlier
   Please define below how you want to send commands to your monitoring instance.
   Configure Monitoring Security
   Configure admin user


   Finish the setup to get the Login page. Enter admin account username and password created earlier.

Configure Icinga 2 master node

  1. icinga2 node wizard

Welcome to the Icinga 2 Setup Wizard!

We will guide you through all required configuration details.

Please specify if this is a satellite/client setup ('n' installs a master setup) [Y/n]: n

Starting the Master setup routine...

Please specify the common name (CN) [ubuntu-01]: icinga2-master Reconfiguring Icinga... Checking for existing certificates for common name 'icinga2-master'... Certificates not yet generated. Running 'api setup' now. Generating master configuration for Icinga 2. Enabling feature api. Make sure to restart Icinga 2 for these changes to take effect. Please specify the API bind host/port (optional): Bind Host []: Bind Port []:


Now restart your Icinga 2 daemon to finish the installation!

sudo systemctl restart icinga2.service

To generate a ticket for the client on the master node, use syntax

  1. icinga2 pki ticket --cn 'clientname'

In our next article, we will cover the configuration of Icinga 2 clients to be monitored. You can support us by downloading this article as PDF from the Link below.


Pranala Menarik