Page 1 of 1

Hostgroup relations trough REST API

Posted: Mon Jun 11, 2018 9:51 am
by sltn_support
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.

Re: Hostgroup relations trough REST API

Posted: Mon Jun 11, 2018 10:59 am
by mcapra
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

Re: Hostgroup relations trough REST API

Posted: Mon Jun 11, 2018 2:34 pm
by cdienger
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"