Reschedule-check on all services

Hello community,

We have a chat bot which is using the API to perform a reschedule-check on a host or on a specific service. This is working fine, only I also want to make is possible to perform a reschedule-check on all services of a host. In the API documentation I don’t see a “Check all services” option. Is it true that this option not exist or do I reading over it all the time?

Ofcourse it is possible to first get all services with “/v1/objects/services” and using a for loop to send the reschedule-check for every service. But it would be much easier if you can do this in 1 single API call.

Please let me know, thanks! :slight_smile:

Can you try this example? (my environment has wayyyyy to many hosts/services to try this out on my own without causing issues):

curl -k -s -S -i -u root:icinga -H 'Accept: application/json' \
 -X POST 'https://localhost:5665/v1/actions/reschedule-check' \
 -d '{ "type": "Service", "filter": "service.name==\"*\"", "force": true, "pretty": true }'

Just a wild card for the filter. Documentation doesn’t give me any reason to believe that it wouldn’t work.

Edit to add: change your creds/url accordingly :slight_smile:

Thanks for your reply! Unfortunately, it doesn’t seems to work.

This is working fine:

curl -k -s -S -i -u root:icinga -H 'Accept: application/json' \
 -X POST 'https://localhost:5665/v1/actions/reschedule-check' \
 -d '{ "type": "Service", "filter": "host.name==\"example.com\" && service.name==\"PING\"", "force": true, "pretty": true }'

This gives a HTTP 500 response:

curl -k -s -S -i -u root:icinga -H 'Accept: application/json' \
 -X POST 'https://localhost:5665/v1/actions/reschedule-check' \
 -d '{ "type": "Service", "filter": "host.name==\"example.com\" && service.name==\"*\"", "force": true, "pretty": true }'

Oh, do you mean only check all services underneath a single host?

If so, you might just leave the host.name in the filter and drop the service.name portion.

Looking for the or syntax for the API for the next idea below, I accidentally found evidence that suggests that only using the host.name in the filter works: Set downtime for all services of one host via API - #2 by metme01454

If that doesn’t work, you could probably filter for all of the service.states:
service.state==0 and 1,2,3…

2 Likes

Ah sorry, yes I mean only check all services underneath a single host.

Your solution works, thanks! Stupid of me not to try this myself, because I already had this. Only with "type": "Host" instead of "type": "Service" :wink:

Thanks again for your help!

Shameless plug to mark the solution ;p

Glad it worked out without any kind of weird filters like I suggested for the service.state