Page 1 of 1

how to find a host belongs to which hostgroup

Posted: Thu Sep 19, 2019 9:00 am
by axvers
Hi,

we checked the api doc on Nagios XI.

Both hostgroup "Object" and "Config" provide member lists;

but there is no api for "input host, output its hostgroup".

Is there a function for this? without additional script?

Thanks!

Re: how to find a host belongs to which hostgroup

Posted: Thu Sep 19, 2019 9:35 am
by scottwilkerson
You can get them with the objects/hostgroupmembers API

Run command like this

Code: Select all

/nagiosxi/api/v1/objects/hostgroupmembers?apikey=APIKEY&pretty=1&host_name=INPUTHOST