Finding hosts contact_group via API

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
ffffffffffff
Posts: 2
Joined: Thu Jul 20, 2017 8:28 am

Finding hosts contact_group via API

Post by ffffffffffff »

Hi,

I am writing a script to find hosts without a defined contact_group. I am using the RESTful API. The API call I am using does not return a contact or contact_group attribute. According to the object definition document, contact_group is an attribute of host. What am I missing?

https://nagiosserver.com/nagiosxi/api/v ... ey=<apikey>
You do not have the required permissions to view the files attached to this post.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Finding hosts contact_group via API

Post by npolovenko »

Hello, @ffffffffffff. Yes, we've actually put a note for our developers this morning for this issue. Have you considered running a JSON query through the core? http://your_xi_ip/nagios/jsonquery.html Select Object JSON CGI and then query Host.
You could also embed a basic authentication in your query, just like that:

Code: Select all

http://username:password@your_xi_ip/nagios/cgi-bin/objectjson.cgi?query=host
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
ffffffffffff
Posts: 2
Joined: Thu Jul 20, 2017 8:28 am

Re: Finding hosts contact_group via API

Post by ffffffffffff »

npolovenko wrote:Hello, @ffffffffffff. Yes, we've actually put a note for our developers this morning for this issue. Have you considered running a JSON query through the core? http://your_xi_ip/nagios/jsonquery.html Select Object JSON CGI and then query Host.
You could also embed a basic authentication in your query, just like that:

Code: Select all

http://username:password@your_xi_ip/nagios/cgi-bin/objectjson.cgi?query=host
Thanks for the quick reply. I have not considered that, nor did I know about it. The current API is great. Exposing the rest of Nagios would be very beneficial.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Finding hosts contact_group via API

Post by lmiltchev »

@ffffffffffff Is it OK to close this topic, and mark it as "resolved"? Thanks!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked