I just try to migrate from Icinga 1 System with icinga-idoutils (1.11.6-1+b4) to Icinga2 with icinga2-ido-mysql (2.7.0-1.stretch).
Now I found, that in the new Icinga2 system old Hosts aren鈥檛 deleted anymore in the Database, although they are completely deleted from Icinga2 config.
Deleting a Host in Icinga2 should delete that host in the ido database (as the old icinga1 version does).
Old hosts stay in the database.
DELETE icinga_hosts, icinga_hoststatus FROM icinga_hosts
INNER JOIN icinga_hoststatus ON icinga_hosts.host_object_id = icinga_hoststatus.host_object_id
WHERE icinga_hoststatus.status_update_time < cast((now() - interval 1 day) as date);
DELETE icinga_services, icinga_servicestatus FROM icinga_services
INNER JOIN icinga_servicestatus ON icinga_services.service_object_id = icinga_servicestatus.service_object_id
WHERE icinga_servicestatus.status_update_time < cast((now() - interval 3 day) as date);
I am also using the Icinga Director, but IMHO this should not made any difference.
Some problem exist for services.
This is intentional because removing objects would render IDs in other history tables unusable. You need to check the is_active column in the icinga_objects table to see whether an object still exists.
I'm running into this behavior as well- I set up both a localhost service and a "hostname-of-localhost" service when experimenting with the configuration, and now I can't get rid of one or the other despite standardizing on "localhost".
Is it expected behavior? It seems that I will now have an obsolete "hostname-of-localhost" service indefinitely. Should mark "hostname-of-localhost" as "not active", and how do I do that? This looks like it will lead to necessarily conflicting information, where lookups of the same node via different paths (localhost or by correct hostname) will give different results.
@tim-win How did you solve your problem with orphaned status-entrys in icingaweb?
I had a small enough test environment to blow away the database and start from scratch.
@gunnarbeutner Can this be repopened, as there still doesn't seem to be a way to set the active behavior of hosts, or conversely can you link the documentation to how to set active behavior of hosts (as this is indexed by google and now a _definitive source_).
Please move this discussion to https://community.icinga.com
If you'd like to move to a new location- can you start a conversation there and provide a link? this is the first google result when you search for a similar string.
Most helpful comment
This is intentional because removing objects would render IDs in other history tables unusable. You need to check the
is_activecolumn in theicinga_objectstable to see whether an object still exists.