How To Install Icinga on CentOS 8

Install Icinga on CentOS 8

In this tutorial we will show you how to install Icinga on CentOS 8. For those of you who didn’t know, Icinga 2 is an open source network monitoring system which checks the availability of your network resources, notifies users of outages, and generates performance data for reporting. Its Scalable and extensible, Icinga2 can monitor large, complex environments across multiple locations.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Icinga 2 on a CentOS 8 server.

Install Icinga on CentOS 8

Step 1. First let’s start by ensuring your system is up-to-date.

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

Step 2. Installing Icinga on CentOS.

After addition of EPEL repository, add Icinga 2 repository to your system:

sudo tee /etc/yum.repos.d/icinga2.repo<<EOF
[icinga2]
name=Icinga 2 Repository for EPEL 8
baseurl=https://packages.icinga.com/epel/8/release
enabled=1
EOF

Import GPG Key:

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

Next, Update yum cache:

sudo dnf clean all
sudo dnf makecache

Now run the Icinga 2 Installation command as shown below:

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

Enable Icinga 2 required modules:

sudo icinga2 feature enable command ido-mysql syslog

Step 3. Installing MariaDB and Configure Database Icinga.

Install MariaDB database server on your CentOS 8:

sudo dnf module install mariadb

Activate the mariadb service using the command below:

sudo systemctl enable --now mariadb

Once the service is started, run the command mysql_secure_installation to harden MariaDB database server security.

mysql_secure_installation

Then, create a database for Icinga 2:

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

Import Icinga 2 Database:

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

Next, we configure Database access:

nano /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 = "YourpASSWD"
  host = "localhost"
  database = "icingadb"
}

Then start and enable icinga2 service:

sudo systemctl enable --now icinga2.service

Confirm service status:

$ sudo 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-16 10:36:13 EAT; 4s ago
  Process: 13746 ExecStartPre=/usr/lib/icinga2/prepare-dirs /etc/sysconfig/icinga2 (code=exited, status=0/SUCCESS)
 Main PID: 13756 (icinga2)
    Tasks: 11 (limit: 11222)
   Memory: 18.6M
   CGroup: /system.slice/icinga2.service
           ├─13776 /usr/lib64/icinga2/sbin/icinga2 --no-stack-rlimit daemon --close-stdio -e /var/log/icinga2/error.log
           ├─13761 /usr/lib64/icinga2/sbin/icinga2 --no-stack-rlimit daemon --close-stdio -e /var/log/icinga2/error.log
           └─13752 /usr/lib64/icinga2/sbin/icinga2 --no-stack-rlimit daemon --close-stdio -e /var/log/icinga2/error.log

Congratulation’s! You have successfully installed Icinga 2. Thanks for using this tutorial for installing Icinga 2 network monitoring on CentOS systems. For additional help or useful information, we recommend you to check the official Icinga website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get a best deal!