icinga2/doc/2.4-setting-up-ido.md

3.2 KiB

Configuring IDO

The IDO (Icinga Data Output) modules for Icinga 2 takes care of exporting all configuration and status information into a database. The IDO database is used by a number of projects including Icinga Web.

There is a separate module for each database back-end. At present support for both MySQL and PostgreSQL is implemented. This installation guide assumed that you are using MySQL.

Note

Icinga 2 uses the Icinga 1.x IDOUtils database schema starting with version 1.11.0.

Setting up the database

First of all you have to install the icinga2-ido-mysql package using your distribution's package manager. Once you have done that you can proceed with setting up a MySQL database for Icinga 2:

Note

The Debian packages can optionally create and maintain the database for you using Debian's dbconfig framework. This is the recommended way of setting up the database.

# mysql -u root -p

mysql> CREATE DATABASE icinga;
Query OK, 1 row affected (0.01 sec)

mysql>  GRANT USAGE ON icinga.* TO 'icinga'@'localhost'
          IDENTIFIED BY 'icinga'
          WITH MAX_QUERIES_PER_HOUR 0
          MAX_CONNECTIONS_PER_HOUR 0
          MAX_UPDATES_PER_HOUR 0;

mysql>  GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE
          ON icinga.* TO 'icinga'@'localhost';

mysql>  FLUSH PRIVILEGES;

mysql> quit

After creating the database you can import the Icinga 2 IDO schema using the following command:

# mysql -u root -p icinga < /usr/share/doc/icinga2-ido-mysql-*/schema/mysql.sql

Note

The Icinga 2 RPM packages install the schema files into /usr/share/doc/icinga2-ido-mysql-*/schema (* means package version). The Icinga 2 dist tarball ships the schema files in components/db_ido_mysql/schema/.

On SuSE-based distributions the schema files are installed in /usr/share/doc/packages/icinga2-ido-mysql/schema.

Upgrading the database

If the database has been installed and requires an upgrade, verify the current schema version first:

# mysql -u root -p icinga -e 'SELECT version FROM icinga_dbversion;'
+---------+
| version |
+---------+
| 1.10.0  |
+---------+

Check the schema/upgrade directory for an incremental schema upgrade file, e.g. if your database schema version is 1.10.0 look for mysql-upgrade-1.11.0.sql and newer. Apply all database schema upgrade files incrementially.

# mysql -u root -p icinga < /usr/share/doc/icinga2-ido-mysql-*/schema/upgrade/mysql-upgrade-1.11.0.sql

Note

The Icinga 2 IDO module will check for the required database schema version on startup and generate an error message if not satisfied.

Installing the IDO module

The package provides a new configuration file that is installed in /etc/icinga2/features-available/ido-mysql.conf. You will need to update the database credentials in this file.

You can enable the ido-mysql feature configuration file using icinga2-enable-feature:

# icinga2-enable-feature ido-mysql
Module 'ido-mysql' was enabled.
Make sure to restart Icinga 2 for these changes to take effect.

After enabling the ido-mysql feature you have to restart Icinga 2:

# /etc/init.d/icinga2 restart