Install and configure Icinga 2 and Icinga Web 2 on CentOS 8 / RHEL 8

Welcome to the guide on how to install Icinga 2 on CentOS 8 / RHEL 8 using Icinga Web 2. Icinga 2 is a free and open source monitoring tool designed to scale and scale. Icinga 2 checks the availability of network resources, notifies users of interruptions, and generates performance data for reporting. Icinga 2 can be used to monitor large and complex environments in multiple locations.

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 equipment-routers and switches

Features of Icinga 2

These are the main features provided by Icinga 2:

  • Performance-oriented: Icinga 2 has a multi-threaded design that can run thousands of checks per second without any sign of CPU strain.
  • Distributed architecture: For large and complex environments, make a distributed setup with high availability.
  • REST API: Icinga 2 provides a RESTful API that lets you update configurations on the fly or display real-time information about current issues on a custom dashboard.
  • Rule-based configuration: Use dynamic configuration as code for monitoring. Apply rules to hosts and services to create a continuous monitoring environment.
  • Warning: You will be notified immediately when there is a problem with the app via email, text message or mobile message.
  • Icinga 2 has native support for Graphite and InfluxDB. You can easily send the collected performance data directly to third-party tools.
  • Icinga 2 supports NagiosGrapher, PNP4Nagios and InGraph plugins

Icinga 2’s standard web interface is called Icinga Web 2

Install Icinga 2 on CentOS 8 / RHEL 8

Now start installing Icinga2 on CentOS 8 / RHEL 8. Here are the steps to make sure Icinga 2 is running on CentOS 8 / RHEL 8 Linux distribution.

Step 1: Update the system

Make sure your CentOS / RHEL system is up to date:

sudo yum -y update

Step 2: Enable EPEL repository

Make sure EPEL repository is enabled in RHEL 8 / CentOS 8 system.

Enable EPEL repository on CentOS 8 / RHEL 8

The one-line command that is run is:

sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

If you are running RHEL 8, consider enabling other repositories.

sudo subscription-manager repos --enable=rhel-8-server-optional-rpms 
  --enable=rhel-8-server-extras-rpms

Step 3: Add Icinga 2 repository to CentOS 8 / RHEL 8

After adding the EPEL repository, add the Icinga 2 repository to the system.

sudo tee /etc/yum.repos.d/icinga2.repo<

Import GPG key:

sudo rpm --import https://packages.icinga.com/icinga.key

Update Yum cache

sudo dnf clean all
sudo dnf makecache

Step 4: Install MariaDB database server

Install MariaDB database server on CentOS / RHEL 8 server.

Install MariaDB on CentOS / RHEL 8

After installation, create a database and user for Icinga2:

$ mysql -u root -p
CREATE DATABASE icinga;
GRANT ALL PRIVILEGES ON icinga.* TO 'icinga'@'localhost' IDENTIFIED BY '[email protected]';
FLUSH PRIVILEGES;
EXIT;

Step 5: Install Icinga 2 on CentOS 8 / RHEL 8

Run the following command to install Icinga 2 on CentOS 8 / RHEL 8.

sudo dnf -y install icinga2 icinga2-selinux icinga2-ido-mysql vim-icinga2

Here is the dependency tree:

Dependencies resolved.
===================================================================================================================================================
 Package                            Arch                    Version                                               Repository                  Size
===================================================================================================================================================
Installing:
 icinga2                            x86_64                  2.11.2-1.el8.icinga                                   icinga2                     33 k
 icinga2-ido-mysql                  x86_64                  2.11.2-1.el8.icinga                                   icinga2                    117 k
 icinga2-selinux                    x86_64                  2.11.2-1.el8.icinga                                   icinga2                     64 k
Installing dependencies:
 boost-context                      x86_64                  1.66.0-6.el8                                          AppStream                   15 k
 boost-coroutine                    x86_64                  1.66.0-6.el8                                          AppStream                   31 k
 boost-filesystem                   x86_64                  1.66.0-6.el8                                          AppStream                   49 k
 mysql-common                       x86_64                  8.0.17-3.module_el8.0.0+181+899d6349                  AppStream                  143 k
 mysql-libs                         x86_64                  8.0.17-3.module_el8.0.0+181+899d6349                  AppStream                  1.2 M
 icinga2-bin                        x86_64                  2.11.2-1.el8.icinga                                   icinga2                    3.8 M
 icinga2-common                     x86_64                  2.11.2-1.el8.icinga                                   icinga2                    152 k
Enabling module streams:
 mysql                                                      8.0                                                                                   

Transaction Summary
===================================================================================================================================================
Install  10 Packages

Total download size: 5.7 M
Installed size: 27 M

Launch and enable

Required modules to enable Icinga 2:

sudo icinga2 feature enable command ido-mysql syslog

You can check and enable other features as needed:

$ sudo icinga2 feature list
Disabled features: api compatlog debuglog elasticsearch gelf graphite influxdb livestatus opentsdb perfdata statusdata syslog
Enabled features: checker command ido-mysql mainlog notification

Import the Icinga 2 database:

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

Configure database access:

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

Uncomment the line and set access credentials.

/**
 * The IdoMysqlConnection type implements MySQL support
 * for DB IDO.
 */

object IdoMysqlConnection "ido-mysql" {
  user = "icinga"
  password = "[email protected]"
  host = "localhost"
  database = "icinga"
}

Then start and enable the icinga2 service.

sudo systemctl enable --now icinga2.service

Confirm the service status.

$ systemctl status icinga2.service
● icinga2.service - Icinga host/service/network monitoring system
   Loaded: loaded (/usr/lib/systemd/system/icinga2.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2019-11-12 10:27:10 EAT; 6s ago
  Process: 13756 ExecStartPre=/usr/lib/icinga2/prepare-dirs /etc/sysconfig/icinga2 (code=exited, status=0/SUCCESS)
 Main PID: 13766 (icinga2)
    Tasks: 11 (limit: 11512)
   Memory: 16.6M
   CGroup: /system.slice/icinga2.service
           ├─13766 /usr/lib64/icinga2/sbin/icinga2 --no-stack-rlimit daemon --close-stdio -e /var/log/icinga2/error.log
           ├─13781 /usr/lib64/icinga2/sbin/icinga2 --no-stack-rlimit daemon --close-stdio -e /var/log/icinga2/error.log
           └─13782 /usr/lib64/icinga2/sbin/icinga2 --no-stack-rlimit daemon --close-stdio -e /var/log/icinga2/error.log

Nov 12 10:27:10 centos8.novalocal icinga2[13766]: [2019-11-12 10:27:10 +0300] information/ConfigItem: Instantiated 1 UserGroup.
Nov 12 10:27:10 centos8.novalocal icinga2[13766]: [2019-11-12 10:27:10 +0300] information/ConfigItem: Instantiated 1 IdoMysqlConnection.
Nov 12 10:27:10 centos8.novalocal icinga2[13766]: [2019-11-12 10:27:10 +0300] information/ConfigItem: Instantiated 235 CheckCommands.
Nov 12 10:27:10 centos8.novalocal icinga2[13766]: [2019-11-12 10:27:10 +0300] information/ConfigItem: Instantiated 3 TimePeriods.
Nov 12 10:27:10 centos8.novalocal icinga2[13766]: [2019-11-12 10:27:10 +0300] information/ConfigItem: Instantiated 1 User.
Nov 12 10:27:10 centos8.novalocal icinga2[13766]: [2019-11-12 10:27:10 +0300] information/ConfigItem: Instantiated 11 Services.
Nov 12 10:27:10 centos8.novalocal icinga2[13766]: [2019-11-12 10:27:10 +0300] information/ConfigItem: Instantiated 3 ServiceGroups.
Nov 12 10:27:10 centos8.novalocal icinga2[13766]: [2019-11-12 10:27:10 +0300] information/ScriptGlobal: Dumping variables to file '/var/cache/icin>
Nov 12 10:27:10 centos8.novalocal icinga2[13766]: [2019-11-12 10:27:10 +0300] information/cli: Closing console log.
Nov 12 10:27:10 centos8.novalocal systemd[1]: Started Icinga host/service/network monitoring system.

Install Icinga Web 2 on CentOS 8 / RHEL 8

Now that we have completed the installation of Icinga 2 on CentOS 8 / RHEL 8 server, let's continue the work of installing Icinga Web 2 on CentOS 8 / RHEL 8. For installation steps, refer to the following guides:

How to install Icinga Web 2 on CentOS 8 / RHEL 8

More information about monitoring:

Install Zabbix Server on CentOS / RHEL 8

Install Cacti on CentOS / RHEL 8

Install LibreNMS on CentOS / RHEL 8

Install Netdata on CentOS / RHEL 8

Sidebar