Hi,
Is there a way to get al hostgroup relations trought the Rest API.
like: hostgroup_12
host: 12
services: 20
[ show services in hostgroup]
Regards, Patrick.
Hostgroup relations trough REST API
Re: Hostgroup relations trough REST API
I don't think that could be done without chaining API calls. I might be wrong as I haven't touched the REST API in a while.
I made a custom REST API endpoint a while back that gets hosts in a hostgroup. A safe assumption would be that any services assigned to a returned host are, given how inheritance works, also in the hostgroup. I can't imagine the modifications required to return services would be that dramatic, but I don't know them off the top of my head.
https://support.nagios.com/forum/viewto ... 93#p214393
I made a custom REST API endpoint a while back that gets hosts in a hostgroup. A safe assumption would be that any services assigned to a returned host are, given how inheritance works, also in the hostgroup. I can't imagine the modifications required to return services would be that dramatic, but I don't know them off the top of my head.
https://support.nagios.com/forum/viewto ... 93#p214393
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: Hostgroup relations trough REST API
host group membership can be gathered via the objects/hostgroupmembers endpoint. To get the members of the linux-severs group for example:
curl -XGET "http://XI/nagiosxi/api/v1/objects/hostg ... ux-servers"
curl -XGET "http://XI/nagiosxi/api/v1/objects/hostg ... ux-servers"
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.