Icinga

Upgrading IDOUtils database

There may be a bug within the database scheme which has been fixed. If you are upgrading from an older IDOUtils version you also need to apply those fixes manually. If you are using rpm/deb packages please read the notes and/or ask the maintainer if he has added those modifications to the install routine.

The upgrade files can be found next to the database install files in

/path/to/icinga-src/module/idoutils/db/

The syntax is as follows

<rdbm>-upgrade-<version>.sql

where <rdbm> could be mysql, pgsql or oracle and <version> points to the version you want to upgrade to.

[Note] Note

If you are upgrading from an older version and there are other versions in between be advised that you need to apply those upgrade files with incremental steps!

E.g. you have 1.0RC1 installed and want to upgrade to 1.0.1 - you will have to upgrade to 1.0 Stable first and then apply the upgrade to 1.0.1

  1. Backup your current database before upgrading!

  2. Check current IDOUtils version and the target version. Check if there are any version in between and upgrade incremental if necessary.

  3. Apply the upgrade(s) using a rdbm user with appropriate rights. You may use the upgradedb script, but this is not recommended (for MySQL only).

MySQL
 $ mysql -u root -p <dbname> < /path/to/icinga-src/module/idoutils/db/mysql-upgrade-<version>.sql
Postgresql
 # su - postgres
 $ psql -U icinga -d icinga < /path/to/icinga-src/module/idoutils/db/pgsql-upgrade-<version>.sql
Oracle
 # su - oracle
 $ sqlplus dbuser/dbpass
 SQL> @oracle-upgrade-<version>.sql
Upgrading IDOUtils to 1.0

There was a unique key failure coming through the fork causing several tables to keep duplicated and useless rows. This concerns the following tables:

If you look at the table creation e.g. servicechecks:

 mysql> show create table icinga_servicechecks;

you should see something like this

 PRIMARY KEY (`servicecheck_id`),
 KEY `instance_id` (`instance_id`),
 KEY `service_object_id` (`service_object_id`),
 KEY `start_time` (`start_time`)

Changing this to

 PRIMARY KEY (`servicecheck_id`),
 UNIQUE KEY `instance_id` (`instance_id`,`service_object_id`,`start_time`,`start_time_usec`)

will need your attention on the following procedure!

If you are upgrading from 1.0RC please be advised to use module/idoutils/db/mysql-upgrade-1.0.sql - if you are using an older version, please apply the incremential steps to get to 1.0RC first!

Please backup your database and stop ido2db before applying this patch!

  1. /etc/init.d/ido2db stop
  2. mysql -u root -p icinga < /path/to/icinga-src/module/idoutils/db/mysql-upgrade-1.0.sql

The patch will do the following through MySQL statements:

This procedure will be executed for each table, so it might take quite a long time depending on your table size and/or db specs.

If you changed something on the keys before please make sure you'll have the same database scheme applied as in 1.0RC otherwise the script will fail.