Hostgroup relations trough REST API

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
sltn_support
Posts: 20
Joined: Thu Dec 07, 2017 10:12 am

Hostgroup relations trough REST API

Post 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.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Hostgroup relations trough REST API

Post 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
Former Nagios employee
https://www.mcapra.com/
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Hostgroup relations trough REST API

Post 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"
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked