Json query for empty hostgroups

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Json query for empty hostgroups

Post by WillemDH »

Hello,

it seems like the json query

curl -s "user:pw@srvnagios01/nagios/cgi-bin/objectjson.cgi?query=hostgrouplist"

is not able to find empty hostgroups. Is this normal behaviour? It kind of messes up some of my script as I'm looking is a hostgroup exists with this, but it might be this hostgroup was very recently created...

Is there some json query that does find all the hostgroups including the empty ones?

Grtz

Willem
Nagios XI 5.8.1
https://outsideit.net
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Json query for empty hostgroups

Post by lmiltchev »

Nagios Core discards the hostgroups with no members in them and they are not even shown in the web UI. In Nagios XI you see them, as the info is pulled from the database.

I was able to verify that by using the below query:

Code: Select all

curl -s "user:pw@srvnagios01/nagios/cgi-bin/objectjson.cgi?query=hostgrouplist"
you are not going to be able to pull information about "empty" hostgroups. You could however use the Backend API component in XI to do so ("Hostgroups" URL).
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Json query for empty hostgroups

Post by WillemDH »

Ok, I'll try the backend api. It would be nice though if it could be added to json, but I guess that would be a core feature requesst.
Nagios XI 5.8.1
https://outsideit.net
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Json query for empty hostgroups

Post by lmiltchev »

Ok, I'll try the backend api.
Let us know if this works out for you.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Json query for empty hostgroups

Post by WillemDH »

it doesn't really work out for me.. Seems it's not technically possible to get empty hostgroups with json, which just is not very practical. Please close this thread.
Nagios XI 5.8.1
https://outsideit.net
Locked