I have a hook which creates and deletes hosts from check_mk, it should set and remove downtime when stopping or starting the instance in our virtualization environment. With the HTTP API it was working without any problems in a distributed monitoring environment.
Now when using the REST API, setting a downtime only works for hosts monitored by the master, when trying it with hosts monitored by a slave, i still get the resp.status_code 204, but the downtime is not set.
I tried it with multiple hosts monitored by the master and hosts monitored by different slaves, the downtime was only set to those monitored by the master.
Any idea how to make it work?
I am running check-mk-raw-2.0.0p5 as a distributed monitoring environment.
As far as i know - you have to sent the downtime API request to the host the machine is monitored on.
But this can also be a bug or a design problem. I think someone has already tested this with a enterprise edition to say that it is also the same way there or that it is working. If it working inside the enterprise then it is a bug/limitation of the raw.
But i cannot say at the moment if it is this way. Normally it should be possible over the master as most times the single slaves are not reachable for every user.
Well, I hope it is not a limitation problem pf the RAW, since setting downtime is possible with the HTTP API up to 2.0.0.p5, which I am currently using. Hope it is just s bug.
It doesn’t make a sense sending API requests to the respective slave for these operations, I always thought using the API for some actions is a as good as using WATO as long as the API supports it, so this shouldn’t be a new limitation of the RAW. But who knows.
you can just refactor the code fragment you need without the Literal, so Literal basically ensures that some expression has literally a specific value, this code for instance ensures that mode is one of the list members:
i am using 2.0.0p9 (CEE) and i can not create a host-related downtimes via rest api. I also get a status-code 204. It does not matter which site the host belongs to. It neither works on the master site nor a slave one. I would realy like to use it in ansible-playbooks. I would be very grateful for a suggested solution.
I have solved my problem, i did not gave a duration, because i thought i would be calculated. but it might be not calculated. So if i set the duration correctly in the json request data. it works.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.