Icinga 2:

It is a free and open source monitoring tool which helps you to monitor network resources, get an alert on outages, also be able to generate the performance data.

Also, it is very scalable, and you can monitor small to larger, complex environments across multiple locations.

Supports all major distributions such as Debian, Ubuntu, CentOS / RHEL, Fedora, openSUSE, SLES, Gentoo, FreeBSD, and ArchLinux.

 

To begin,  switch to the root user

$ sudo su -

 

Icinga packages depend on other packages (ex. Nagios plugins) which are distributed in EPEL repository. So, configure the EPEL repository on CentOS 7 / RHEL 7.

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

 

In addition to this, enable the optional and extras repositories on RHEL 7.

subscription-manager repos --enable rhel-7-server-optional-rpms
subscription-manager repos --enable rhel-7-server-extras-rpms

 

Add Icinga 2 Repository

Icinga provides its official repository for their packages. So, install repository rpm

rpm --import https://packages.icinga.com/icinga.key
yum install https://packages.icinga.com/epel/icinga-rpm-release-7-latest.noarch.rpm

 

Install Icinga 2

yum -y install icinga2

 

To start Icinga2 service, run:

systemctl start icinga2

 

To set Icinga 2 service to start automatically on system startup, run:

systemctl enable icinga2

 

SELinux

 

If the system has SELinux enabled, then Install the below package to have targeted policy for Icinga 2.

yum install -y icinga2-selinux

 

Install Nagios Plugins

 

Without the plugins, Icinga 2 does not know how to monitor the external services. So install Nagios plugins on top of Icinga 2.

 

yum -y install nagios-plugins-all

 

Configuring DB IDO MySQL

 

The DB IDO module for Icinga 2 takes care of exporting all the configuration and status information to the database; we need to have database server for this requirement.

 

At present, MySQL and PostgreSQL are supported. Here, we will use the MySQL server as a database server.

 

If you already have a MySQL server on your system, you can skip the below step.

yum -y install mariadb-server mariadb

 

Start and enable MariaDB service.

systemctl start mariadb
systemctl enable mariadb

 

Install IDO modules for MySQL

 

Now, install IDO modules for MySQL using the following command. You can find the icinga2-ido-mysql package in Icinga 2 repository.

yum -y install icinga2-ido-mysql

 

Create Database for Icinga 2

 

Login to MariaDB using the following command.

mysql -u root -p

 

Create a database for IDO modules, and this is used when you set up the Icinga2 web interface.

CREATE DATABASE icinga2;
grant all privileges on icinga2.* to icinga2@localhost identified by 'icinga123';
FLUSH PRIVILEGES;
quit

 

After creating the database, you shall import the Icinga 2 IDO schema using the following command.

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

 

Enable IDO MySQL Module

 

Let’s lists the available and enabled features in Icinga 2.

icinga2 feature list

Output:

Disabled features: api command compatlog debuglog 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 ido-mysql is not enabled on your system, then enable it using below command.

icinga2 feature enable ido-mysql

 

Also, enable the command feature which helps Icinga web interface and other Icinga add-ons to send commands to Icinga 2 via the external command pipe.

icinga2 feature enable command

 

Configure IDO DB MySQL module

Once you have enabled the IDO modules in Icinga 2, the Icinga 2 places the new configuration file at /etc/icinga2/features-enabled/ido-mysql.conf in which you need to update the database credentials manually.

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

 

Update the above file shown like below.

user = "icinga2",
password = "icinga123",
host = "localhost",
database = "icinga2"

 

Restart the Icinga 2 instance to have this enabled features take effect.

systemctl restart icinga2

 

Check the status of Icinga 2 service.

 systemctl status icinga2

 

Output:

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 2018-09-24 09:00:58 UTC; 16h ago
 Main PID: 11656 (icinga2)

Firewall

Configure the firewall to allow Icinga 2 clients to communicate with Icinga 2 server.

firewall-cmd --permanent --add-port=5665/tcp
firewall-cmd --reload

 

We will configure the Icinga 2 web interface in our next tutorial.

That’s All.

Bu cevap yeterince yardımcı oldu mu? 26 Bu dökümanı faydalı bulan kullanıcılar: (91 Oy)