I’m trying to use the Icinga API to retrieve host groups information.
I would like to know if it exists a request when I specify a host and a hostgroup and the API replies a boolean to determine if the specified host is member of the specified group.
This requests gives all members of a group :
curl -k -s -S -i -X GET -H 'Accept: application/json' -u 'user:password' 'https://ICINGA_IP:5665/v1/objects/hosts?filter=%22GROUP1%22%20in%20host.groups'
This other request gives all groups of the specified host :
curl -k -s -S -i -X GET -H 'Accept: application/json' -u 'user:password' 'https://ICINGA_IP:5665/v1/objects/hosts?host=hostname&attrs=groups
How can I specify the hostname AND the hostgroup in the same request ?
I tried with ?filter without success.
If the hostname is member of the hostgroup, then reply.
If not, reply an error or “object not found”.
Can someone help me ?