Get host overview via API (number of service per host)

Hi,

Is it possible to get a quick overview of the Hosts doing a call to the API (could vi RESTApi or Web).?

To be more precise I want to get the number of services and status per host like we have here:

2021-05-04 14_25_52-Window

Any other ideas are also welcome.

Thanks in advance !

Hello @alrodrig!

You’d have to fetch all services, filtered by host name (the last check result attribute only) and to count the states.

Best,
AK

Hi @Al2Klimov

Thanks for the answer. It’s easy to fetch all services filtered by hostname and also using the last check attrs or even the state directly. My problem starts when I need to count them, do you have any example or idea ? I tried with jq however I couldn’t do it.

This is the request I’m using throw the API:

https:/localhost:5665/v1/objects/services?filter=match("",host.name)&attrs=state

You have to change < hostname >. and the server name (localhost).

Thanks in advance !

What exactly have you tried with jq?