2014-02-05 15:53:22 +01:00
|
|
|
## <a id="configuring-ido"></a> Configuring IDO
|
2013-09-27 13:56:11 +02:00
|
|
|
|
|
|
|
The IDO (Icinga Data Output) modules for Icinga 2 takes care of exporting all
|
2013-10-01 12:59:02 +02:00
|
|
|
configuration and status information into a database. The IDO database is used
|
|
|
|
by a number of projects including Icinga Web.
|
2013-09-27 13:56:11 +02:00
|
|
|
|
2013-11-20 10:29:37 +01:00
|
|
|
There is a separate module for each database back-end. At present support for
|
2014-01-29 13:31:43 +01:00
|
|
|
both MySQL and PostgreSQL is implemented.
|
2013-09-27 13:56:11 +02:00
|
|
|
|
2013-10-11 15:34:30 +02:00
|
|
|
> **Note**
|
|
|
|
>
|
|
|
|
> Icinga 2 uses the Icinga 1.x IDOUtils database schema starting with version
|
2014-02-05 15:53:22 +01:00
|
|
|
> `1.11.0`. Icinga 2 may require additional features not yet released with
|
|
|
|
> Icinga 1.x and therefore require manual upgrade steps during pre-final
|
|
|
|
> milestone releases.
|
2013-10-11 15:34:30 +02:00
|
|
|
|
2014-02-05 15:53:22 +01:00
|
|
|
### <a id="configuring-ido-mysql"></a> Configuring IDO MySQL
|
2014-01-29 13:31:43 +01:00
|
|
|
|
2014-02-05 15:53:22 +01:00
|
|
|
#### <a id="setting-up-mysql-db"></a> Setting up the MySQL database
|
2013-09-27 13:56:11 +02:00
|
|
|
|
2013-11-20 10:29:37 +01:00
|
|
|
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.
|
2013-09-30 09:04:49 +02:00
|
|
|
|
2013-09-27 13:56:11 +02:00
|
|
|
# mysql -u root -p
|
|
|
|
|
2014-01-29 13:31:43 +01:00
|
|
|
mysql> CREATE DATABASE icinga;
|
2013-09-27 13:56:11 +02:00
|
|
|
|
2014-01-29 13:31:43 +01:00
|
|
|
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE ON icinga.* TO 'icinga'@'localhost' IDENTIFIED BY 'icinga';
|
2013-09-27 13:56:11 +02:00
|
|
|
|
|
|
|
mysql> quit
|
|
|
|
|
2014-01-29 13:31:43 +01:00
|
|
|
|
2013-09-30 09:04:49 +02:00
|
|
|
After creating the database you can import the Icinga 2 IDO schema using the
|
2013-10-01 12:59:02 +02:00
|
|
|
following command:
|
2013-09-30 09:04:49 +02:00
|
|
|
|
2013-10-11 15:34:30 +02:00
|
|
|
# mysql -u root -p icinga < /usr/share/doc/icinga2-ido-mysql-*/schema/mysql.sql
|
|
|
|
|
|
|
|
> **Note**
|
|
|
|
>
|
2013-10-11 15:51:53 +02:00
|
|
|
> The Icinga 2 RPM packages install the schema files into
|
2013-10-18 20:05:08 +02:00
|
|
|
> `/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/`.
|
2013-11-20 10:29:37 +01:00
|
|
|
>
|
|
|
|
> On SuSE-based distributions the schema files are installed in
|
|
|
|
> `/usr/share/doc/packages/icinga2-ido-mysql/schema`.
|
2013-10-11 15:34:30 +02:00
|
|
|
|
2014-02-05 15:53:22 +01:00
|
|
|
#### <a id="upgrading-mysql-db"></a> Upgrading the MySQL database
|
2013-10-11 15:34:30 +02:00
|
|
|
|
|
|
|
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 |
|
|
|
|
+---------+
|
2014-01-29 13:31:43 +01:00
|
|
|
| 1.11.0 |
|
2013-10-11 15:34:30 +02:00
|
|
|
+---------+
|
|
|
|
|
|
|
|
Check the `schema/upgrade` directory for an incremental schema upgrade file, e.g.
|
2014-01-29 13:31:43 +01:00
|
|
|
if your database schema version is `1.10.0` look for `mysql-upgrade-1.12.0.sql`
|
|
|
|
and newer. If there isn't an upgrade file available there's nothing to do.
|
2013-10-11 15:34:30 +02:00
|
|
|
Apply all database schema upgrade files incrementially.
|
|
|
|
|
2014-01-29 13:31:43 +01:00
|
|
|
# mysql -u root -p icinga < /usr/share/doc/icinga2-ido-mysql-*/schema/upgrade/mysql-upgrade-1.12.0.sql
|
2013-10-11 15:34:30 +02:00
|
|
|
|
|
|
|
> **Note**
|
|
|
|
>
|
|
|
|
> The Icinga 2 IDO module will check for the required database schema version
|
|
|
|
> on startup and generate an error message if not satisfied.
|
2013-09-27 13:56:11 +02:00
|
|
|
|
2014-02-05 15:53:22 +01:00
|
|
|
#### <a id="installing-ido-mysql"></a> Installing the IDO MySQL module
|
2013-09-27 13:56:11 +02:00
|
|
|
|
|
|
|
The package provides a new configuration file that is installed in
|
2013-10-07 09:35:44 +02:00
|
|
|
`/etc/icinga2/features-available/ido-mysql.conf`. You will need to update the
|
2013-09-27 13:56:11 +02:00
|
|
|
database credentials in this file.
|
|
|
|
|
2013-10-18 22:11:40 +02:00
|
|
|
You can enable the `ido-mysql` feature configuration file using `icinga2-enable-feature`:
|
2013-09-27 13:56:11 +02:00
|
|
|
|
2013-10-18 22:11:40 +02:00
|
|
|
# icinga2-enable-feature ido-mysql
|
2013-09-27 13:56:11 +02:00
|
|
|
Module 'ido-mysql' was enabled.
|
|
|
|
Make sure to restart Icinga 2 for these changes to take effect.
|
|
|
|
|
2013-10-01 12:59:02 +02:00
|
|
|
After enabling the ido-mysql feature you have to restart Icinga 2:
|
2013-09-27 13:56:11 +02:00
|
|
|
|
2013-10-01 12:59:02 +02:00
|
|
|
# /etc/init.d/icinga2 restart
|
2014-01-29 13:31:43 +01:00
|
|
|
|
|
|
|
|
2014-02-05 15:53:22 +01:00
|
|
|
### <a id="configuring-ido-postgresql"></a> Configuring IDO PostgreSQL
|
2014-01-29 13:31:43 +01:00
|
|
|
|
|
|
|
#### Setting up the PostgreSQL database
|
|
|
|
|
|
|
|
First of all you have to install the `icinga2-ido-pgsql` package using your
|
|
|
|
distribution's package manager. Once you have done that you can proceed with
|
|
|
|
setting up a PostgreSQL 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.
|
|
|
|
|
|
|
|
# cd /tmp
|
|
|
|
# sudo -u postgres psql -c "CREATE ROLE icinga WITH LOGIN PASSWORD 'icinga'";
|
|
|
|
# sudo -u postgres createdb -O icinga -E UTF8 icinga
|
|
|
|
# sudo -u postgres createlang plpgsql icinga
|
|
|
|
|
|
|
|
Locate your pg_hba.conf (Debian: `/etc/postgresql/*/main/pg_hba.conf`,
|
|
|
|
RHEL/SUSE: `/var/lib/pgsql/data/pg_hba.conf`), add the icinga user with md5
|
|
|
|
authentification method and restart the postgresql server.
|
|
|
|
|
|
|
|
# vim /var/lib/pgsql/data/pg_hba.conf
|
|
|
|
|
|
|
|
# icinga
|
|
|
|
local icinga icinga md5
|
|
|
|
host icinga icinga 127.0.0.1/32 md5
|
|
|
|
host icinga icinga ::1/128 md5
|
|
|
|
|
|
|
|
# "local" is for Unix domain socket connections only
|
|
|
|
local all all ident
|
|
|
|
# IPv4 local connections:
|
|
|
|
host all all 127.0.0.1/32 ident
|
|
|
|
# IPv6 local connections:
|
|
|
|
host all all ::1/128 ident
|
|
|
|
|
|
|
|
# /etc/init.d/postgresql restart
|
|
|
|
|
|
|
|
|
|
|
|
After creating the database and permissions you can import the Icinga 2 IDO schema
|
|
|
|
using the following command:
|
|
|
|
|
|
|
|
# export PGPASSWORD=icinga
|
|
|
|
# psql -U icinga -d icinga < /usr/share/doc/icinga2-ido-pgsql-*/schema/pgsql.sql
|
|
|
|
|
|
|
|
> **Note**
|
|
|
|
>
|
|
|
|
> The Icinga 2 RPM packages install the schema files into
|
|
|
|
> `/usr/share/doc/icinga2-ido-pgsql-*/schema` (`*` means package version).
|
|
|
|
> The Icinga 2 dist tarball ships the schema files in `components/db_ido_pgsql/schema/`.
|
|
|
|
>
|
|
|
|
> On SuSE-based distributions the schema files are installed in
|
|
|
|
> `/usr/share/doc/packages/icinga2-ido-pgsql/schema`.
|
|
|
|
|
|
|
|
|
2014-02-05 15:53:22 +01:00
|
|
|
#### <a id="upgrading-postgresql-db"></a> Upgrading the PostgreSQL database
|
2014-01-29 13:31:43 +01:00
|
|
|
|
|
|
|
If the database has been installed and requires an upgrade, verify the current
|
|
|
|
schema version first:
|
|
|
|
|
|
|
|
# export PGPASSWORD=icinga
|
|
|
|
# psql -U icinga -d icinga -c "SELECT version FROM icinga_dbversion;"
|
|
|
|
version
|
|
|
|
\---------
|
|
|
|
1.11.0
|
|
|
|
|
|
|
|
Check the `schema/upgrade` directory for an incremental schema upgrade file, e.g.
|
|
|
|
if your database schema version is `1.11.0` look for `pgsql-upgrade-1.12.0.sql`
|
|
|
|
and newer. If there isn't an upgrade file available there's nothing to do.
|
|
|
|
Apply all database schema upgrade files incrementially.
|
|
|
|
|
|
|
|
# export PGPASSWORD=icinga
|
|
|
|
# psql -U icinga -d icinga < /usr/share/doc/icinga2-ido-pgsql-*/schema/upgrade/pgsql-upgrade-1.12.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.
|
|
|
|
|
|
|
|
|
2014-02-05 15:53:22 +01:00
|
|
|
#### <a id="installing-ido-postgresql"></a> Installing the IDO PostgreSQL module
|
2014-01-29 13:31:43 +01:00
|
|
|
|
|
|
|
The package provides a new configuration file that is installed in
|
|
|
|
`/etc/icinga2/features-available/ido-pgsql.conf`. You will need to update the
|
|
|
|
database credentials in this file.
|
|
|
|
|
|
|
|
You can enable the `ido-pgsql` feature configuration file using `icinga2-enable-feature`:
|
|
|
|
|
|
|
|
# icinga2-enable-feature ido-pgsql
|
|
|
|
Module 'ido-pgsql' was enabled.
|
|
|
|
Make sure to restart Icinga 2 for these changes to take effect.
|
|
|
|
|
|
|
|
After enabling the ido-pgsql feature you have to restart Icinga 2:
|
|
|
|
|
|
|
|
# /etc/init.d/icinga2 restart
|
|
|
|
|
|
|
|
|