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](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Token-1.jpg)
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](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Token-2.jpg)
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](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Modules.jpg)
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](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Requirements-1.jpg)
We should have found these requirements problems:
![Icinga 2 Web Setup Wizard Requirements PHP Timezone](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Requirements-3.jpg)
![Icinga 2 Web Setup Wizard Requirements PHP Module INTL](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Requirements-4.jpg)
![Icinga 2 Web Setup Wizard Requirements PHP Module Imagick](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Requirements-5.jpg)
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"
![Icinga 2 Web Setup Wizard Requirements PHP Timezone php.ini](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Requirements-6.jpg)
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](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Requirements-7.jpg)
![Icinga 2 Web Setup Wizard Requirements PHP Module INTL](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Requirements-8.jpg)
![Icinga 2 Web Setup Wizard Requirements PHP Module Imagick](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Requirements-9.jpg)
Given that we will use MySQL, you can ignore the PostgreSQL requirements…
![Icinga 2 Web Setup Wizard Requirements](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Requirements-2.jpg)
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](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Configuration-2.jpg)
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](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Configuration-3.jpg)
The icingaweb2 database must be also created, so it needs MySQL root credentials:
![Icinga 2 Web Setup Wizard Configuration Database Setup](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Configuration-4.jpg)
Choose the icingaweb2 as authentication backend
![Icinga 2 Web Setup Wizard Configuration Authentication Backend](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Configuration-5.jpg)
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](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Configuration-6.jpg)
Adjust these settings for application and logging:
![Icinga 2 Web Setup Wizard Configuration Application Configuration](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Configuration-7.jpg)
Icinga Web 2 succesfully configured. We can follow with the Next (push the button) screen
![Icinga 2 Web Setup Wizard Configuration Review Changes](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Configuration-8.jpg)
The monitoring module configuration starts here
![Icinga 2 Web Setup Wizard Configuration Welcome Monitoring Module](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Configuration-9.jpg)
Choose backend type and name:
![Icinga 2 Web Setup Wizard Configuration Monitoring Backend](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Configuration-10.jpg)
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](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Configuration-11.jpg)
Set the way to send commands to the monitoring instance
![Icinga 2 Web Setup Wizard Configuration Command Transport](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Configuration-12.jpg)
The protected custom variables to add some security
![Icinga 2 Web Setup Wizard Configuration Monitoring Security](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Configuration-13.jpg)
Finally configured the monitoring module!
![Icinga 2 Web Setup Wizard Configuration monitoring changes](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Configuration-14.jpg)
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](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Configuration-15.jpg)
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](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Wizard-Configuration-16.jpg)
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](https://somoit.net/content/images/2016/07/Icinga-2-Web-Setup-Console-First-Login.jpg)