16 C
Texas

How To Setup Icinga Web Interface On Ubuntu 20.04

In this tutorial, you’ll learn that how to setup Icinga 2 web interface. In our previous guide we already cover the installation of Icinga 2 on Ubuntu 20.04. If you missed the installation guide visit the below link.

How To Install Icinga 2 on Ubuntu 20.04

Icinga 2 Web provides the interface for Web and centralized interface for the Network monitoring. For easy and optimal settings follow the complete guide.

Step 1: Update Your System

As usual we do, first of all update your system to the latest packages by hitting the below command.

- Advertisement -
sudo apt -y update && sudo apt -y upgrade

Step 2: Adding Icinga 2 Repository on Ubuntu 20.04

To add the icinga 2 repository on Ubuntu 20.04, make sure to be the root user or switch it by

sudo su -

Also make sure to get the https and curl packages if they are not already installed.

apt-get install -y apt-transport-https curl

Then run the given command to add the Icinga public signing key

curl https://packages.icinga.com/icinga.key | apt-key add -

After it fire the below command to add the Icinga repository on Ubuntu 20.04.

echo "deb http://packages.icinga.com/ubuntu icinga-$(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/icinga2.list
echo "deb-src http://packages.icinga.com/ubuntu icinga-$(lsb_release -sc) main" | sudo tee -a /etc/apt/sources.list.d/icinga2.list

Then update the repository cache by running the command.

apt-get update

Step 3: Install PHP Packages on Ubuntu 20.04

Fire the given command to install the PHP packages required for Icinga 2 web on Ubuntu 20.04.

apt-get install -y php-gd php-json php-dba php-intl php-ldap php-pdo-mysql php-pgsql php-imagick php-dom

Note:During installation I got error due to the latest php version(7.4). So, if you face the same issue switch to the previous version of php like 7.0 as Icinga doesn’t support latest version. Install the PHP7.0 by running below command with the remaining extensions.

add-apt-repository ppa:ondrej/php
apt update
apt-get install -y php7.0
add-apt-repository ppa:ondrej/php
apt-update
apt-get install -y php7.0-gd php7.0-json php7.0-dba php7.0-intl php7.0-ldap php7.0-pdo-mysql php7.0-pgsql php7.0-imagick php7.0-dom

Then restart the apache server.

systemctl restart apache2

Step 4: Installing Icinga Web 2

Now, as we’ve already added the repository for icinga web 2 run the below command to install the icinga web 2.

apt-get install -y icingaweb2

As the Icinga Web 2 also have the CLI installed in it in order to perform different operations from CLI as well as from web. So, both have access to logs & configs. To do this add the web server user (www-data) to the system group (icingaweb2).

addgroup --system icingaweb2
usermod -a -G icingaweb2 www-data

And then set the timezone according to your time in php.ini file.

nano /etc/php/7.*/apache2/php.ini
date.timezone= Asia/Karachi

Then restart the apache server.

systemctl restart apache2

Step 5: Setup Icinga Web 2

Now, visit the below link to start the wizard for setting up Icinga Web 2.

http://your.ip.addr.ess/icingaweb2/setup
or
localhost/icingaweb2/setup

And run the following command in your terminal to generate a toke for security.

icingacli setup token create

You’ll see the similar output

icingacli setup token create
The newly generated setup token is: e00b72902b690722

On Browser wizard, copy and paste the above generated token & hit Next.

How To Setup Icinga Web Interface On Ubuntu 20.04

On the next screen, select the installed modules(during icinga installation) to enable them & hit the Next button.

How To Setup Icinga Web Interface On Ubuntu 20.04

Below pages output the information of the system, timezone & the PHP extensions.

How To Setup Icinga Web Interface On Ubuntu 20.04
How To Setup Icinga Web Interface On Ubuntu 20.04

Note: If anything missing, you’ll need to install it before proceeding further. If everything goes fine then click on Next button.

In next step choose the authentication type. Make sure that Icinga Web 2 supports the AD, LDAP & Local for authentication purposes. Here I’m going to use local. For this select Database.

How To Setup Icinga Web Interface On Ubuntu 20.04

As Icinga Web 2 stores info in database, so create one for it. Type in the terminal.

mysql -u root -p
> CREATE DATABASE icingawebdb;
> grant all privileges on icingawebdb.* to icingaweb@localhost identified by 'icinga123';
> quit

And put these database details in the Wizard opened in browser & click Next.

How To Setup Icinga Web Interface On Ubuntu 20.04

Now, type authentication backend name & click Next button.

How To Setup Icinga Web Interface On Ubuntu 20.04

In next step create an admin account. Make sure to keep the credentials in safe place.

Fill the details for storing logs & configs. Then click Next.

How To Setup Icinga Web Interface On Ubuntu 20.04

Finally review your settings & click Next.

How To Setup Icinga Web Interface On Ubuntu 20.04

And click Next on the next screen to configure the monitoring of Icinga web 2.

How To Setup Icinga Web Interface On Ubuntu 20.04

Choose monitoring backend for retrieving the info. I’m going to use IDO.

How To Setup Icinga Web Interface On Ubuntu 20.04

As we’ve already created the DB for IDO in Icinga 2 installation, so use that one. Click here to go the installation post to see the Database details. Enter the IDO database details & click on Next button .

How To Setup Icinga Web Interface On Ubuntu 20.04

Step 6: Setup Command Transport

Icinga Web 2 support the following command transports.

  • Local Command File
  • Icinga 2 API (Recommended)
  • Remote Command Line

It’s up to you to use multiple command transport or single one. For demo here I’m going to use single local command transport.

  • Local Command File
  • Icinga 2 API

Fire the given command to setup Icinga 2 API command transport.

icinga2 api setup

Output:

Here’s output sample.

icinga2 api setup

information/cli: Generating new CA.
warning/cli: CA files '/var/lib/icinga2/ca//ca.crt' and '/var/lib/icinga2/ca//ca.key' already exist.
warning/cli: Found CA, skipping and using the existing one.
information/cli: Private key file '/var/lib/icinga2/certs//Ubuntu20.localdomain.key' already exists, not generating new certificate.
information/cli: Adding new ApiUser 'root' in '/etc/icinga2/conf.d/api-users.conf'.

You can find the API user detail in /etc/icinga2/conf.d/api-users.conf file.

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

Then restart the Icinga 2 services.

Now, provide the above credentials on the web page & click Next.

Then enter the variable info to protect yourself from bad ones. Then click Next.

How To Setup Icinga Web Interface On Ubuntu 20.04

Finally review your monitoring configuration.

Below given page shows the successful setup of Icinga Web 2.

How To Setup Icinga Web Interface On Ubuntu 20.04

Hit the Login to Icinga Web 2 button.

Step 7: Accessing Icinga Web 2

Now, provide the admin account details created earlier to login.

How To Setup Icinga Web Interface On Ubuntu 20.04

You’ll see the Icinga Web 2 dashboard here.

How To Setup Icinga Web Interface On Ubuntu 20.04

Now, navigate to Overview>>Hosts to look all the connected hosts.

How To Setup Icinga Web Interface On Ubuntu 20.04

So, this is how you can setup Icinga Web 2 on Ubuntu 20.04. In our next tutorial, we’ll cover the monitoring of remote hosts.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article