How to get all Service States from a Vlan Host

Hello,
I’m new in Icinga and maybe you can help me with my question.

My short python program will use the API to query information about the status of all services of a manuell choosen host. So i will be able to do a quick check via bash.
I wonder if there is a way to get all host services listed with their current state, without doing a request for each service.

Thanks for your help!

Hello,
Yup, you can request the service endpoint without specifying a service and you are good, in a curl request it would look like this :
curl -k -u user:pass -H ‘X-HTTP-Method-Override: GET’ ‘https://yourserver:5665/v1/objects/services’ -d ‘{ “attrs”: [“name”,“state”] }’

Thanks a lot for your answer!
But this command will request all existing services on icinga - via the api. I just want to request all services of a specific host.

Sorry, i misunderstood your request, in this case you need to change the data to add a filter on the host name :
'{ "attrs": ["name","state"], "filter": "\"myhostname\" == host.name" }'

2 Likes