Is there a way to remove old hosts from the icinga2 database?

#1

Hello,

is there an easy way to remove old hosts from the icinga2 database?

It came to my attention that the table “icinga_objects” still contains every host, which was ever configured in icinga2. those outdated hosts are marked with “is_active = 0”. is there an official way to purge those old hosts? In my case there are >100k outdated entries in this table.

The “cleanup” section in the docs does not cover this subject:
https://icinga.com/docs/icinga2/latest/doc/09-object-types/#idomysqlconnection

Any suggestion whould be helpful.
Thanks!

#2

Afaik only with some database alterations inside the DB itself.
E.g. by removing all entries that have is_active=0

No warranties though :wink: And do backups of the DB before :wink:

(Kai) #3

Direct DB manipulations? (“O nooooo…” :face_with_hand_over_mouth:) How about using “icingacli director host delete …” in a loop in a shell script? /KB