Housekeeping in director

  • Director version (System - About): 1.11.1
  • Icinga Web 2 version and modules (System - About): 2.12.1
  • Icinga 2 version (icinga2 --version): 2.14.2
  • Operating System and version: Debian 11
  • Webserver, PHP versions: Apache, PHP 7.4.33

Hey there.

After 3 years of heavily using the director to sync our devices and vms from netbox, our director database has grown to about 50GB.
We are doing the household task regularly, but we have 3 tables in the database which we would like to cut a little since they occupy most of the space:

  • director_activity_log 19GB
  • director_generated_file 17GB
  • director_deployment_log 323MB

There is a Github issue which mentions ways to downsize two of the tables (How do you delete the audit log? · Issue #1442 · Icinga/icingaweb2-module-director · GitHub) but there is no word about the director_generated_file-table.
So my question is: Is there a way to downsize this table also?

Thanks for any enlightenment.
Patric

did you try that:
Thomas-Gelf commented on Mar 26, 2018

Oh, sure :see_no_evil:. No guarantee that this works, but in theory it should:

DELETE FROM director_deployment_log WHERE start_time < NOW() - INTERVAL 30 DAY;
DELETE FROM director_activity_log WHERE change_time < NOW() - INTERVAL 30 DAY;

you can remove the entry in the deployment log but you can also update it

‘config_checksum’=>null

than there is this icingacli command mentioned:

icingacli director housekeeping run

Once you did so, please run:

OPTIMIZE TABLE director_deployment_log;
OPTIMIZE TABLE director_generated_config;
OPTIMIZE TABLE director_generated_config_file;
OPTIMIZE TABLE director_generated_file;
OPTIMIZE TABLE director_activity_log;

if there is no reference to a deployment log anymore the housekeeping task will clean up the generated files table see here :

1 Like

There are two (more) issues regarding cleanup.

Have not tried those myself yet, but they look like they could be implemented.

OPTIMIZE TABLE director_deployment_log; +----------------------------------+----------+----------+-------------------------------------------------------------------+ | Table | Op | Msg_type | Msg_text | +----------------------------------+----------+----------+-------------------------------------------------------------------+ | director.director_deployment_log | optimize | note | Table does not support optimize, doing recreate + analyze instead | | director.director_deployment_log | optimize | status | OK | +----------------------------------+----------+----------+-------------------------------------------------------------------+

ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`director`.`director_generated_config`, CONSTRAINT `director_generated_config_activity` FOREIGN KEY (`last_activity_checksum`) REFERENCES `director_activity_log` (`checksum`))``