Director not deleting hosts no longer in import file

Hi guys,

I’ve recently needed to have director tidy up some unused hosts that no longer exists.

They were originally defined in an import source - which had 48 hosts in ; now has 1.

I’ve updated my sync rule to set purge from No to Yes - which I was expecting would mean that icinga would remove the 47 hosts that no longer exists. However this isn’t the case.

Have or misunderstood what purge would do, or missed something else ?

Thanks

HI, what happens if you choose replace? In our experience the sync rule deletes everything what is not in the Import source and Change every var which is diffent to to Import source.

Did you let the import source check for changes and trigger the sync of those changes and after that let the sync rule to check for changes of the import source?

Hi @stevie-sy, @log1c - thanks both for the replies.

I’ve changed to replace (that probably makes more sense for what I was trying to do!). I’ve also done some manual tidy up.

It would seem to me that merge+purge doesn’t remove anything; I thought it might merge data in the records, but deleting missing - which probably doesn’t make much sense. I wonder if ‘purge’ should only work with ‘replace’.

The other issue I seemed to be hitting is - for things where i’d already removed a few weeks ago from the config file and done a sync with purge set to false - those were left on the system. Presumably as they had already been removed from director; and so it didn’t recognise the record in icinga as something it could purge.

For my particular use case, where i’m trying to use director and a defined json file to populate the hosts, running with replace+purge probably makes most sense.

In any case, thanks for the pointers guys and I’ve resolved the issue with your assistance :wink:

2 Likes

Good that you got it working.
Small but: For me merge&purge is working when syncing host objects from AD, but for merge to work the key column has to be the exact same (or better the value in it). Otherwise the director doesn’t have the correct property to compare the import to.