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 that checks the availability of your network resources, notifies users of outages, and generates performance data for reporting. It’s 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 the step-by-step installation of Icinga 2 on a CentOS 8.
Prerequisites
- A server running one of the following operating systems: CentOS 8.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
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 the addition of the 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
Congratulations! 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.