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>
Finding hosts contact_group via API
-
ffffffffffff
- Posts: 2
- Joined: Thu Jul 20, 2017 8:28 am
Finding hosts contact_group via API
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
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:
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=hostAs 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
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.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
Re: Finding hosts contact_group via API
@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!