Icinga 2.13.6 - Master DB & Icingaweb2
These notes are based on the official and pretty awful Icinga2 documentation at:
Unless stated otherwise, all the following commands should be run as root.
Steps which are not mentioned in the official documentation are shown in italics. Steps in the official documentation which you should not perform are also shown in italics.
The following should be done on a Master, and on a Satellite if you wish to run Icingaweb2 on it
- Set up the API:
icinga2 api setup
- This will create a new Certificate Authority and enable the API feature in Icinga2.
- Restart Icinga2 to let the new configuration take effect:
/etc/init.d/icinga2 restart
- Set up IcingaDB:
aptitude install icingadb-redis
- Leave the configuration file /etc/icingadb-redis/icingadb-redis.conf as it is for now
- You may want to edit it later if you decide to run Icingaweb2 on a different machine, pointing at this server's database
- Enable Icinga DB and restart Icinga2 for this to take effect:
icinga2 feature enable icingadb /etc/init.d/icinga2 restart
- Install the Icinga DB daemon:
aptitude install icingadb
- Install MariaDB:
aptitude install mariadb-server mariadb-client
- Install MariaDB support for Icinga:
aptitude install icinga2-ido-mysql
- When prompted, answer "yes" to "Enable Icinga2's ido-mysql feature?" and "Configure database for icinga2-ido-mysql with dbconfig-common?"
- Choose a good password for the database user - you will need this later in the configuration
- Press enter when prompted for the root DB password - MariaDB doesn't use one on a local Unix socket connection
- Create the database and its schema:
mysql create database icingadb; create user 'icingadb'@'localhost' identified by 'ChooseYourOwnPasswordHere'; grant all on icingadb.* to 'icingadb'@'localhost'; exit mysql icingadb </usr/share/icingadb/schema/mysql/schema.sql
- You should now have a working Icinga2 installation, with no way of knowing.
- The next step is to install Icingaweb2 so that you can find out whether Icinga2 is working or not.
- Install Icingaweb2 and the CLI for Icinga, plus Apache2 and the Icingaweb2 monitoring module, otherwise it still won't do anything useful, and also php and php-xml, which are needed (but not mentioned in the standard documentation):
aptitude install icingaweb2 icingacli apache2 icingaweb2-module-monitoring php php-xml
- You may also wish to install additional modules such as icingaweb2-module-nagvis and icingaweb2-module-pnp
- On the other hand, you may prefer not to install icingaweb2-modules-pnp, because there is no way of using it, since it ultimately tells you "Unmet dependencies found! Module can't be enabled unless all dependencies are met" and "This module requires PNP4Nagios to be fully configured and installed". PNP4Nagios has not been available as a Debian package since 2016. You're probably better off trying to work out how to integrate Grafana with Icinga if you want nice graphs of historical data.
- Create the icingaweb2 database and grant access to it:
mysql create database icingaweb2; grant all on icingaweb2.* to icingaweb2@localhost identified by 'ChooseAnotherGoodPasswordHere'; exit
- Create a web configuration token for use in the next step:
icingacli setup token create
- Point a (reasonably modern) browser at http://this.new.ser.ver/icingaweb2/setup
- You should be prompted for the setup token - paste this into the box and click "Next"
- If you do not see "Monitoring" listed amongst the Modules on the next screen, exit from the browser and ensure that you have the package "icingaweb2-module-monitoring" installed
- If you also installed extra modules such as icingaweb2-module-nagvis and icingaweb2-module-pnp, you should see them also listed here. Select them so that you get prompted for any configuration stesp they may require
- Click on "Next" to find out what you missed from the PHP installation. If everything is green, click on Next. If some are green and some are yellow, check the yellow ones to make sure you do not seem to need them, and click on "Next". If any are red, you'll need to install them, restart Apache2 and click on "Refresh".
- In my case I was missing php-pdo-mysql:
aptitude install php-pdo-mysql /etc/init.d/apache2 restart
- Clicking on "Refresh" should now show no red results
- Click on "Next"
- Accept Authentication by Database and click on "Next"
- Enter the following details into the Database resource screen:
- Database Name: icingaweb2
- Username: icingaweb2
- Password: Whatever you entered when asked to "ChooseAnotherGoodPasswordHere" above
- Click on "Validate Configuration" and, provided you see "The configuration has been successfully validated", click on "Next"
- If you do not see "The configuration has been successfully validated", verify the credentials by returning to the command line and trying to connect to the database:
mysql -u icingaweb2 -p icingaweb2
- If that doesn't work, check carefully whether the creation of the database above went without any errors being reported.
- Accept Authentication Backend as "icingaweb2" and click on "Next"
- Create a new administrative user for Icingaweb2 and click on "Next"
- Accept the standard settings for Application Configuration
- You should now see "You've configured Icinga Web 2 successfully". Review the setting displayed and click on "Next" if they seem okay, or "Back" if you wish to change anything
- You can now configure the Monitoring Module, without which Icingaweb2 is quite useless
- Click on "Next"
- Enter the following details into the Monitoring IDO Resource screen:
- Database Name: icinga2
- Username: icinga2
- Password: Whatever you entered when setting up the Icinga2 database early in the configuration
- Click on "Validate Configuration" and, provided you see "The configuration has been successfully validated", click on "Next"
- If you see "There is currently no icinga instance writing to the IDO. Make sure that a icinga instance is configured and able to write to the IDO", check:
- the database name and credentials in the file /etc/icinga2/features-available/ido-mysql.conf
- that the ido-mysql feature is enabled ("icinga2 feature enable ido-mysql")
- The next screen Command Transport asks whether you want the Transport Type to be a Local Command File or a Remote Command File
- If I ever find any documentation explaining what the difference between these is and why you should choose one or the other, I'll add that here, but for now I simply recommend accepting the defaults because I haven't found any information on which to base an alternative choice
- The Monitoring Security screen can be left with the default setting
- Click on Finish, and despite everything having been completed so far, you will probably see "Sorry! Failed to set up Icinga Web 2 successfully."
- In my case the report ended with:
Cannot enable module "monitoring". Check the permissions for the enabledModules directory: /etc/icingaweb2/enabledModules Module "nagvis" could not be enabled. An error occured: WARNING: Module "nagvis" can't be enabled. Module has unmet dependencies Module "pnp" could not be enabled. An error occured: WARNING: Module "pnp" can't be enabled. Module has unmet dependencies
- Why these dependencies were not mentioned when I installed things is not clear.
- The first error was resolved by:
chown www-data:icingaweb2 /etc/icingaweb2/enabledModules
This allowed me then to log in to Icingaweb2 and see what was being monitored (at this stage, very little, on the local machine only)
- The second error (once you look at "modules" in detail) tells you "This module requires NagVis to be configured and installed. It provides an additional authentication-, authorisation and logon implementation for NagVis". There are no further clues on how to configure nagvis, and on my machine at least, it already got installed along with icingaweb2-module-nagvis
- The third error cannot be resolved, since "This module requires PNP4Nagios to be fully configured and installed" and PNP4Nagios was removed from Debian in 2016.
You can proceed with connecting Masters, Satellites and Agents together.
Go up
Return to main index.