Hello,
Another API question: how can we determine the status of a service via the API? We'd like to be able to determine if a service is either OK, Warn or Critical.
Thanks,
-- Mike Beebe
API: H/T determine service status
Re: API: H/T determine service status
You could use GET objects/hoststatus and objects/servicestatus.
Example from the CLI:
This service is in CRITICAL state ( "current_state": "2").
Code: Select all
https://x.x.x.x/nagiosxi/api/v1/objects/hoststatus?apikey=xxx&pretty=1
http://x.x.x.x/nagiosxi/api/v1/objects/servicestatus?apikey=xxx&pretty=1Code: Select all
curl -s "http://x.x.x.x/nagiosxi/api/v1/objects/servicestatus?apikey=xxx&pretty=1&host_name=localhost&name=Total%20Processes" | grep current_state
"current_state": "2",You do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: API: H/T determine service status
That worked -- thanks!
Please feel free to close this thread.
Please feel free to close this thread.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: API: H/T determine service status
Excellent!mbeebe wrote:That worked -- thanks!
Please feel free to close this thread.
Locking