Saturday, November 16, 2024
Google search engine
HomeGuest BlogsInstall and Configure Icinga 2 on CentOS 8 / RHEL 8

Install and Configure Icinga 2 on CentOS 8 / RHEL 8

Welcome to out guide on how to install Icinga 2 on CentOS 8 / RHEL 8 with Icinga Web 2. Icinga 2 is a free and open source monitoring tool designed to be scalable and extensible Icinga 2 checks the availability of your network resources, notifies users of outages, and generates performance data for reporting. Icinga 2 can be used to monitor large and complex environments across 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 devices – Routers and switches

Features of Icinga 2

These are the top features which Icinga 2 provides:

  • Performance-oriented: Icinga 2 has a multi-threaded design, it can run thousands of checks each second without any sign of CPU strain.
  • Distributed Architecture: For 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 support NagiosGrapher, PNP4Nagios, and InGraph addons

The standard web interface for Icinga 2 is called Icinga Web 2

Install Icinga 2 on CentOS 8 / RHEL 8

Let’s now begin the installation of Icinga 2 on CentOS 8 / RHEL 8. Below are the steps you’ll follow to ensure you have a running Icinga 2 on CentOS 8 / RHEL 8 Linux distribution.

Step 1: Update system

Ensure your CentOS / RHEL system is up-to-date:

sudo yum -y update

Step 2: Enable EPEL Repository

Ensure EPEL repository is enabled in your RHEL 8 / CentOS 8 system.

One line command to run is:

sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf config-manager --set-enabled powertools

If you’re running RHEL 8, consider enabling additional 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 addition of EPEL repository, add Icinga 2 repository to your system.

sudo dnf -y install https://packages.icinga.com/epel/icinga-rpm-release-8-latest.noarch.rpm

Update Yum cache

sudo dnf clean all
sudo dnf makecache

Step 4: Install MariaDB Database Server

Install MariaDB database server on your CentOS / RHEL 8 server.

After installation, create database and user for Icinga2:

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

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

Run the commands below to install Icinga 2 on CentOS 8 / RHEL 8.

sudo dnf install icinga2 icinga2-selinux icinga2-ido-mysql vim-icinga2 nagios-plugins-all

Below is the dependency tree:

Dependencies resolved.
======================================================================================================================================================================================================
....

Transaction Summary
======================================================================================================================================================================================================
Install  15 Packages

Total download size: 5.4 M
Installed size: 26 M
Is this ok [y/N]: y

Start and enable

Enable Icinga 2 required modules:

sudo icinga2 feature enable command ido-mysql syslog

You can check and enable other features on demand:

$ 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 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 lines and set access credentials.

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

object IdoMysqlConnection "ido-mysql" {
  user = "icinga"
  password = "StroNgP@ss"
  host = "localhost"
  database = "icinga"
}

Then start and enable icinga2 service.

sudo systemctl enable --now icinga2.service

Confirm 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’ve completed the installation of Icinga 2 on CentOS 8 / RHEL 8 server, let’s move on to install Icinga Web 2 on CentOS 8 / RHEL 8. Refer to the guide below for installation steps:

More on Monitoring:

RELATED ARTICLES

Most Popular

Recent Comments