I have an Icinga2 setup to monitor the servers and resources of my company. I have previously experimented using the API to change host variables and ran into some problems which were explained in my old thread:
In the end i decided to handle the host vars via the configuration files and just push up new configurations to the Icinga master when the vars needed to be changed.
Unfortunately I still have a few host vars that I set using the API that I cannot revert back to be “unset” by API and then handled by the configuration files. Is there a way to purge old API-changed host vars so that I can continue managing them using pure configuration files?
I’m thinking some database hacking or similar to remove all old revisions set using the API… Have tried to dissect the database schema to understand how something like that can be done but so far without success.
I’m very interested in a solution, too. Unfortunately removing or cleaning /var/lib/icinga2/modified-attributes.conf does not help. removing it and calling
icinga2 daemon --validate && systemctl reload icinga2
does instantly re-create the file with its previous content.
Only way: Stop icinga daemon, remove modified-attributes.conf and restart icinga really reverts to the settings from file.
This can’t be serious, there should be a less intrusive way!
I don’t know how this get_object(“Host”, “myhost”).restore_attribute(“vars”) thing should be entered…