Page 1 of 1
Finding hosts contact_group via API
Posted: Thu Nov 16, 2017 1:41 pm
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>
Re: Finding hosts contact_group via API
Posted: Thu Nov 16, 2017 2:21 pm
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
Re: Finding hosts contact_group via API
Posted: Thu Nov 16, 2017 3:00 pm
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.
Re: Finding hosts contact_group via API
Posted: Thu Nov 16, 2017 4:16 pm
by lmiltchev
@ffffffffffff Is it OK to close this topic, and mark it as "resolved"? Thanks!