huben
(Ben)
December 6, 2022, 12:29pm
1
How can I set a single service in Downtime using the Webapi, for example using a command on bash like this:
curl -k "https://some.url.net/some_site/check_mk/view.py?
_username=USER
&_secret=PASSWORD
&filled_in=actions
&actions=yes
&_transid=-1
&_do_confirm=yes
&_do_actions=yes
&view_name=service
&host=server01
&_down_from_now=yes
&_down_minutes=1
&_down_comment=In_Downtime
&service=Check_MK"
This command above unfortunately does not work and I also can’t figure it out using the docu.
Best regards!
Yggy
December 6, 2022, 2:45pm
2
Unfamiliar with the web api, I am using rest api myself.
I had several issues popping up as soon as I went for SSL, since we use self signed certification on intern network.
Wrote a how to for it a while ago, maybe it helps you.
Following workaround for raw users might be a no no to share, since recurring scheduled downtimes is an enterprise feature. If indeed not appreciated, just remove the topic.
Warning: I am a newbie regarding rest api, bash scripting & cron so following might be done better or may impose risks. But made this today, tested it and seems to be working. (-:
Using Checkmk Raw Edition 2.1.0p5 on Ubuntu 20.04.
Based on Help | Developer resources | REST API Documentation | Downtimes | Create a host rel…
1 Like
You are missing this:
_do_confirm_service_downtime=yes
If you are using 2.0, then adding the above should work.
On 2.1.0p17, we also fixed a bug with the _transid Fix usage of "_trans_id=-1" in automation calls
1 Like
huben
(Ben)
December 7, 2022, 7:11am
4
Wonderfull, thanks, this was the life saver.
One thing to note, using “_do_confirm_service_downtime=yes” for the service,
“&_do_confirm=yes” seems not to be needed.
It finally worked like this:
curl -k "https://some.url.net/some_site/check_mk/view.py?
_username=USER
&_secret=PASSWORD
&filled_in=actions
&actions=yes
&_transid=-1
&_do_confirm_service_downtime=yes
&_do_actions=yes
&view_name=service
&host=server01
&_down_from_now=yes
&_down_minutes=1
&_down_comment=In_Downtime
&service=Check_MK"
Could there be any side effect leaving the “&_do_confirm=yes” option?
system
(system)
Closed
December 7, 2023, 7:12am
5
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.