The second of my post series to show the installation and setup of the Icinga monitoring tool. This one covers the installation of the Icinga 2 Web frontend.

Please, if havent done before, visit the first post Icinga – Installation / Setup on Debian Linux (1) which covers the installation of the Icinga core engine.

These are the steps i have followed (including the small problems i have found):

Install icinga web 2 packages

# apt-get install icingaweb2

This also installs dependencies like Apache2, PHP…

Icinga web 2 configuration wizard – Welcome (Token)

Access this url by changing to use your IP or hostname to access the configuration wizard:
http://<IP>/icingaweb2/setup or http://<hostname>/icingaweb2/setup

To start using the configuration wizard we have to enter a security we are supposed to have previously created…

Icinga 2 Web Setup Wizard Token

To create the token, just use this icingacli command:

# icingacli setup token create
The newly generated setup token is: 71e1fd13aa7d5f57

To show the value of the created token:

# icingacli setup token show
The current setup token is: 71e1fd13aa7d5f57

After entering the token, the following error was shown: Cannot validate token: /etc/icingaweb2/setup.token (FileObject::__contruct(/etc/icingaweb2/setup.token): failed to open stream: Permission denied)

Icinga 2 Web Setup Wizard Token Error

The www-data user must be included in the icingaweb2 group:

# usermod -a -G icingaweb2 www-data
# service apache2 restart

Icinga web 2 configuration wizard – Modules

If interested, Doc and Translation modules can be checked

Icinga 2 Web Setup Wizard Modules

Icinga web 2 configuration wizard – Requirements

This section shows the requirements needed and if they are correctly installed/configured or not…

Icinga 2 Web Setup Wizard Requirements

We should have found these requirements problems:

Icinga 2 Web Setup Wizard Requirements PHP Timezone
Icinga 2 Web Setup Wizard Requirements PHP Module INTL
Icinga 2 Web Setup Wizard Requirements PHP Module Imagick

To solve the "Default Timezone", add the following line at the beginning of the /etc/php5/apache2/php.ini with the value of your time zone:

date.timezone = "Europe/Madrid"

Search here your timezone

Icinga 2 Web Setup Wizard Requirements PHP Timezone php.ini

And by installing the intl and imagick PHP modules, all the requirements are completed:

# apt-get install php5-intl php5-imagick
# service apache2 restart
Icinga 2 Web Setup Wizard Requirements PHP Timezone
Icinga 2 Web Setup Wizard Requirements PHP Module INTL
Icinga 2 Web Setup Wizard Requirements PHP Module Imagick

Given that we will use MySQL, you can ignore the PostgreSQL requirements…

Icinga 2 Web Setup Wizard Requirements

Icinga web 2 configuration wizard – Configuration

Now, we can follow with the configurations parameters (database, security, credentials…)

Authentication Type: Database

Icinga 2 Web Setup Wizard Configuration Authentication

Fill the database data (name, user and password) to create it and push Validate Configuration button.
If correct validation, push Next

Icinga 2 Web Setup Wizard Configuration Database Resource

The icingaweb2 database must be also created, so it needs MySQL root credentials:

Icinga 2 Web Setup Wizard Configuration Database Setup

Choose the icingaweb2 as authentication backend

Icinga 2 Web Setup Wizard Configuration Authentication Backend

Set the accound data for Icinga web 2 administration (credentials that will be used to login as you will see at the end of the post):

Icinga 2 Web Setup Wizard Configuration Administration

Adjust these settings for application and logging:

Icinga 2 Web Setup Wizard Configuration Application Configuration

Icinga Web 2 succesfully configured. We can follow with the Next (push the button) screen

Icinga 2 Web Setup Wizard Configuration Review Changes

The monitoring module configuration starts here

Icinga 2 Web Setup Wizard Configuration Welcome Monitoring Module

Choose backend type and name:

Icinga 2 Web Setup Wizard Configuration Monitoring Backend

Fill with the appropiate credentials (created on the previous post) to log to the icinga2 database.
Push Validate Configuration and if everything ok, Next

Icinga 2 Web Setup Wizard Configuration Monitoring IDO Resource

Set the way to send commands to the monitoring instance

Icinga 2 Web Setup Wizard Configuration Command Transport

The protected custom variables to add some security

Icinga 2 Web Setup Wizard Configuration Monitoring Security

Finally configured the monitoring module!

Icinga 2 Web Setup Wizard Configuration monitoring changes

Or maybe not!

Sorry! Failed to set up Icinga Web 2 successfully.

Creating new database "icingaweb2"...
Creating database schema...
Creating login "icingaweb2"...
...
...
Monitoring backend configuration could not be written to: /etc/icingaweb2/modules/monitoring/backends.ini. An error occured:
ERROR: RuntimeException in /usr/share/php/Icinga/Util/File.php:97 with message: Failed to create missing directory "/etc/icingaweb2/modules/monitoring/" (mkdir(): Permission denied)
Resource configuration has been successfully updated: /etc/icingaweb2/resources.ini
...
...
Icinga 2 Web Setup Wizard Configuration failed set up

Seems it has no permissions to create a folder on /etc/icingaweb2 folder.
Lets check the permissions:

# ls -ltrh /etc/icingaweb2/
total 32K
drwxr-xr-x 3 root     root       4.0K Jun  6 11:54 modules
-rw-rw---- 1 root     icingaweb2   16 Jun  6 12:22 setup.token
drwxr-s--- 2 www-data icingaweb2 4.0K Jun  6 13:25 enabledModules
-rw-rw---- 1 www-data icingaweb2  156 Jun  6 13:27 config.ini
-rw-rw---- 1 www-data icingaweb2   54 Jun  6 13:27 authentication.ini
-rw-rw---- 1 www-data icingaweb2   77 Jun  6 13:27 roles.ini
-rw-rw---- 1 www-data icingaweb2   54 Jun  6 13:27 groups.ini
-rw-rw---- 1 www-data icingaweb2  327 Jun  6 13:27 resources.ini

Lets add some permissions to www-data user…

# chown -R www-data /etc/icingaweb2/

# ls -ltrh /etc/icingaweb2/
total 32K
drwxr-xr-x 3 www-data root       4.0K Jun  6 11:54 modules
-rw-rw---- 1 www-data icingaweb2   16 Jun  6 12:22 setup.token
drwxr-s--- 2 www-data icingaweb2 4.0K Jun  6 13:25 enabledModules
-rw-rw---- 1 www-data icingaweb2  156 Jun  6 13:27 config.ini
-rw-rw---- 1 www-data icingaweb2   54 Jun  6 13:27 authentication.ini
-rw-rw---- 1 www-data icingaweb2   77 Jun  6 13:27 roles.ini
-rw-rw---- 1 www-data icingaweb2   54 Jun  6 13:27 groups.ini
-rw-rw---- 1 www-data icingaweb2  327 Jun  6 13:27 resources.ini

The problem seems solved! Now the Icinga 2 Web 2 is fully and succesfully configured!

Icinga 2 Web Setup Wizard Configuration succesfully set up

Time for the first login!

Finally, it's time for the first login in the Icinga 2 Web console!
Hope you dont have forgotten the credentials.

Change to use your IP or hostname to access the console:
http://<IP>/icingaweb2 or http://<hostname>/icingaweb2

Icinga 2 Web Setup Console First Login