How to Setup Icinga 2 Web interface on Centos / RHEL 8.

0
158

Prerequisites:

  • Web Server
  • PHP 5.6.0 and above with cURL, gettext,intl,mbstring,OpenSSL, and XML support.
  • LDAP libray(PHP) or Active Directory Authentication.
  • PHP libraries for MySQL or PostgreSQL

Installing PHP and its Extensions

As stated above you must have PHP version 5.6 or above. You should consider the latest version available on Centos / Redhat base repositories. You would need to enable SCL repository and server respectively.
For Centos

yum install -y centos-release-scl

For RHEL

subscription-manager repos –enable rhel-8-server-optional-rpms
subscription-manager repos –enable rhel-server-rhscl-7-rpms

For Centos

 yum -y install rh-php71-php-json rh-php71-php-pgsql rh-php71-php-xml rh-php71-php-intl rh-php71-php-common rh-php71-php-pdo rh-php71-php-mysqlnd rh-php71-php-cli rh-php71-php-mbstring rh-php71-php-fpm rh-php71-php-gd rh-php71-php-zip rh-php71-php-ldap rh-php71-php-imagick

For RHEL

 yum -y install rh-php71-php-json rh-php71-php-pgsql rh-php71-php-xml rh-php71-php-intl rh-php71-php-common rh-php71-php-pdo rh-php71-php-mysqlnd rh-php71-php-cli rh-php71-php-mbstring rh-php71-php-fpm rh-php71-php-gd rh-php71-php-zip rh-php71-php-ldap

Make sure to configure time zone in the php.ini
Now, restart php-fpm services.
Enable Php-fpm services.

Adding Icinga2 Repository

Make sure to add Icinga2 repository if you’ve not already set up it.

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

Installing Icinga2 Web

yum command can be used on Centos/RHEL to install Icinga web package alongwith Icinga CLI & Apache server.

yum -y install icingaweb2 icingacli httpd

Enable Apache Services

systemctl enable httpd

Set up SELinux
Allow Firewall

firewall-cmd –permanent –add-service=http
firewall-cmd –reload

Prepare Icinga Web Setup

Icinga CLI is used for adminstration in command line. Icinga web and CLI must have access to logs&configuration. Add user for web server.

groupadd -r icingaweb2
usermod -a -G icingaweb2 apache

Create Icinga Web 2 configuration directory.

icingacli setup config directory –group icingaweb2

Restart Php-fpm and Apache services.

systemctl restart httpd
systemctl restart rh-php71-php-fpm

For first visit Icinga web setup wizard will guide you through all these steps for the successfull installation.

http://youripaddress/icingaweb2/setup

A token needed to be generated for security reasons. Use this command to generate token.

icingacli setup token create.

Output:
The newly generated setup token is: 04fa4ea1baf4f0b9
use token and click Next.

Choose the modules you’ve installed in Icinga 2

Next screen shows the info timezone and PHP extensions.

Check out all requirements are fulfilled.
A warning of missing PHP Image magic extensions on RHEL 8.
You can install it from Centos repository.

yum -y install http://mirror.centos.org/centos/7/sclo/x86_64/sclo/sclo-php71/sclo-php71-php-pecl-imagick-3.4.3-2.el7.x86_64.rpm
systemctl restart httpd
systemctl restart rh-php71-php-fpm

On next step create Icinga Web 2 user accoutn. Select Database and move to Next.

Login to MySQL server.

mysql -u root -p

Create Database to store Authenication Information.

CREATE DATABASE icingawebdb;
GRANT ALL privileges on icingawebdb.* to icingaweb@localhost IDENTIFIED by ‘icinga123’;
quit

Enter details to proceed.

Choose Authentication backend and move to Next step

Enter the domain account details and remember them for future use.

Select where to save the application and other details and move Next.

Review your settings on the coming screen and move Next.
Configure monitoring module for Icinga Web2. Provide required informations alongwith

Command Transport Setup

These will help you to send commands to monitoring assistances. Icinga Web supports Local Command File, Remote Command File, and Icinga 2 API as a Command Transport.
You can also design your own.
We use here Local Command file for demo. You can choose your required one.

Run the below command to set up API.

Icinga2 API

icinga2 api setup


Output:

View API user detail from /etc/icinga2/conf.d/api-users.conf file

cat /etc/icinga2/conf.d/api-users.conf

Output:

Rstart icinga2 services.

systemctl restart icinga2

Now use user & password from above file.
Make sure to protect from bad ones.

Review your configuration and you are all set up.
Click on Login to Icinga Web 2.

Now login to see dashboard.

Congratulations! you have done installing Icinga Web 2.

LEAVE A REPLY

Please enter your comment!
Please enter your name here