Hi guys,
I’m trying hard to set a downtime for all services of one host via API. In the webfrontend there is a seperate checkbox “all_services” which is working fine, but how can I use it through the API?
I tried for example:
curl -k -s -u 'actionuser' -H 'Accept: application/json' -X POST 'https://SERVER:5665/v1/actions/schedule-downtime?type=Host&host='HOST'&all_services=1' -d '{ "author": "ME", "comment": "TEST", "notify": true, "pretty": true, "start_time": 1561012086, "end_time": 1561033686, "duration": 160, "fixed": false , "all_services": 1}'
I also treid playing arround using type service with wildcards, which is not working at all.
Hope someone can help me here…
Thanks in advance
Best Steve
I just found out the solution by my self: If you are using the type Service and just set the hostfilter, all services from the host(s) will be set in downtime.
url: "{{ icinga_host }}:{{ icinga_api_port }}{{ icinga_dt_url }}type=Service&filter=host.name==%22{{ item }}.{{ ansible_domain }}%22"
The curl command would look like this:
curl -k -s -u 'actionuser' -H 'Accept: application/json' -X POST 'https://SERVER:5665/v1/actions/schedule-downtime?type=Service&host.name='HOST'' -d '{ "author": "ME", "comment": "TEST", "notify": true, "pretty": true, "start_time": 1561012086, "end_time": 1561033686, "duration": 160, "fixed": false}'
1 Like
petew
(pete wilkins)
January 27, 2020, 2:27pm
3
i would not call that a “solution”. it’s still an issue IMHO because the host api doesn’t work as expected with the all_serivces: true
tag.