Placing a host & Services in Downtime via API

api
icinga2

(Rooster) #1

Hi .
When I place a host in downtime its services are are showing up as UNKNOWN for a minute or SO when I shut it down …

curl -k -s -u root:root -H ‘Accept: application/json’ -X POST ‘https://localhost:5665/v1/actions/schedule-downtime?type=Host&filter=host.name=="‘test01’"’ -d ‘{ “start_time”: ‘$startdate’ , “end_time”: ‘$enddate’,“duration”: 1000, “author”: “icingaadmin”, “comment”: “UAT Patching” }’ |python -m json.tool

To Avoid this ,If i include the host and Services

curl -k -s -u root:root-H ‘Accept: application/json’ -X POST 'https://localhost:5665/v1/actions/schedule-downtime?type=Service&filter=host.name==“test01’”’ -d ‘{ “start_time”: ‘$startdate’ , “end_time”: ‘$enddate’,“duration”: 1000, “author”: “icingaadmin”, “comment”: “UAT PAtching” }’ |python -m json.tool

It does not set the downtime for the hostalive check only the services . If I shutdown the server hostalive is alerting .

Is there something I am missing here to include the host and Service checks .

Much appreciated for any help .


(Lars Thegler) #2

I have found we need to call the API twice; one for the host (type=Host), one for the services (type=Service).


(Rooster) #3

HI Lars . Works fine thanks for help …