Go back to configuration after api modification?

I have done modifications to an objects attributes via the api ( Post ) and i forgot the older valieus.
I know that modifying an object atribut via the api does not modify the configuration value of that atribut.

So i need to reset the value to the configuration one.

I already considered the idea of getting the config values and setting them with an api post request but there are too many.
Please help.

I was wondering if setting the attributes to NULL would give them their configuration value.

i tried it.
And no It is not possible to set these attributes to null!

you could just do a reload of the icinga2 daemon which would restore all values to the ones set in the config.

First of all thank you for your answer.
I already tried that. it don’t change a thing!
And i found following log message for all the attribute that i modified before:
**warning/ApiListener: Ignoring config update for object '{the_name_of_my_Service}' of type 'Service'. 'api' does not accept config. **


these values are stored in the original_attributes key in the object. This can be queried and used to modify (restore) the old object attribute.


I’m a bit curious here… So, there is really no easy mechanism to revert back to my configuration files after messing with the API? I have explored this previously and at that point I just left it behind but today I ran into the same problems again.

If the API set value always will take precedence and there is no way to know this (except by querying the API), then I think the settings precedences are badly designed. If I have a sound default configuration based on configuration files I’d like to be able to revert back to that and know that that config set is the one running…


As said, there is a way to restore this from original_attributes. I don’t know of any other way of knowing such without asking the API interface though. Care to elaborate how you would solve this in a better way?



I’m not sure I would solve it in a better way but at least in a different way :slight_smile: Because I find the API somewhat limiting (according to my thread Using API to change host vars), I’d say that a restart with static configuration file actually should revert the changes made by the APi. At least it would be useful to force Icinga to use the static file config.

My reasoning is that because I experience I cannot fully use the API for my purposes then at least there should be a way to “go back” to a known configuration set.