How to Install Icinga 2 on Centos / RHEL 8

0
93

What is Icinga 2?

It is a network monitoring tool that helps you to monitor your network status.
Icinga gets data and after various performance give you status over Internet anywhere.

So, in this lecture we will cover the installation of Icinga 2.

First of all make sure you’ve root privileges.

$ sudo su –

As it depends upon other packages. So, configure EPEL repository on Centos 8 / RHEL 8.

rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

Also enable the optional & extra repositories.

subscription-manager repos –enable rhel-8-server-optional-rpms
subscription-manager repos –enable rhel-8-server-extras-rpms

Adding Icinga 2 Repository

Now, add Icinga 2 repository.

rpm –import https://package.icinga.com/icinga.key
yum install https://package.icinga.com/epel/icinga-rpm-release-8-latest.noarch.rpm

Installing Icinga 2

yum -y install icinga2

Start and enable Icinga Services.

systemctl start icinga2

systemctl enable icinga2

SELinux

Make sure you’ve installed SELinux.

Now install the given package for targeted policy.

yum install -y icinga2-selinux

Plugin is necessary for monitoring. So install Nagios Plugin.

Installing Nagios Plugin

yum -y install nagios-plugins-all

Configuring DB IDO MySQL

DB IDO helps to export all the configuration & status information to database. So, we must have DB server.

If you’ve already installed then skip the below step.

yum -y install mariadb-server mariadb

Now, start and enable MariaDB services.

systemctl start mariadb

systemctl enable mariadb

Make sure to Secure your MariaDB installation.

Installing IDO modules for MySQL

Now install IDO modules for MySQL

yum -y install icinga2-ido-mysql

Creating Database for Icinga2

Now create a Database after logging as a root user. It will help you to set up web interface.

mysql -u -root -p

CREATE DATABASE icinga2;

GRANT ALL PRIVILEGES ON icinga2.* to icinga2@localhost IDENTIFIED BY ‘icinga123’;
FLUSH PRIVILEGES;
quit

Now import the Icinga 2 IDO schema by running this command

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

Enabling IDO MySQL Modules

Now, Enable IDO MYSQL modules.

icinga2 feature list

Output:

Disabled features: api command compatlog elasticsearch gelf graphite influxdb livestatus opentsdb perfdata statusdata syslog
Enabled features: checker ido-mysql mainlog notification

You can see that ido-mysql is already enabled.
If not enabled you can do it by this command.

icinga2 feature enable ido-mysql

For smooth performance, you can also enable command feature.

icinga2 feature enable command

Configuration of IDO DB MySQL module

After enabling IDO module icinga2 changes the file path to /etc/icinga2/features-enabled/ido-mysql.conf.
You can set up DB manually.

vi /etc/icinga2/features-enabled/ido-mysql.conf

Provide your details according to your own requirements.
Now restart icinga2 services.

systemctl restart icinga2

Make sure icinga2 is running.

systemctl status icinga2.

Firewall

If firewall blocks you, give permissions to disable it.

firewall-cmd –permanent –add-port=5665/tcp
firewall-cmd –reload You’ve all done we will cover the web configuration of Icinga 2 in next tutorial.
READ: How to Setup Icinga 2 Web interface on Centos / RHEL 8.

LEAVE A REPLY

Please enter your comment!
Please enter your name here