Hello
Are the Nagiosxi alarms written to database also so you can query those, when alarm happened and when it was corrected? If yes, where is that exactly?
Or this is only written to /var/log/messages and /usr/local/nagios/var/nagios.log log files?
query NagiosXI alarms
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: query NagiosXI alarms
It is, but the correct place to get the info from is the API
Help -> REST API Docs
Most the information you need for this is in the Introduction and Objects Reference sections
Help -> REST API Docs
Most the information you need for this is in the Introduction and Objects Reference sections
Re: query NagiosXI alarms
I looked at the API but i dint find the place where you could use GET method to get all alarms and the resolved state. I dont want to query a specific host or hostgroup, but all of the alarms.
Thank you.
Thank you.
Re: query NagiosXI alarms
The objects/logentries and objects/statehistory endpoints should give you what you're looking for.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: query NagiosXI alarms
At the moment the objects/logentries and objects/statehistory give last 24h alarms, is there a way to get longer time period?
Re: query NagiosXI alarms
Yes. At the top of the "REST API - Objects Reference" are instructions for building queries with the starttime and endtime parameters.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: query NagiosXI alarms
This doesnt work for me. If i use the default 24h query i get result for example logentries or statehistory. If i add the starttime i get empty results in both browser and with command line curl. Even the nagiosxi own example "Displays the last week of data until now." link gives me empty result. Any ideas?
Re: query NagiosXI alarms
It seems to be working on my 5.4.13 system. What version are you working with? What are the curl commands you are using?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: query NagiosXI alarms
I have also 5.4.13 version.
Working queries:
curl -XGET "https://servername/nagiosxi/api/v1/obje ... y&pretty=1" -k
curl -XGET "https://servername/nagiosxi/api/v1/obje ... y&pretty=1" -k
Now if i try to add start-endtime, then empty result, i have tried with:
curl -XGET "https://servername/nagiosxi/api/v1/obje ... key=apikey" -k
curl -XGET "https://servername/nagiosxi/api/v1/obje ... key=apikey" -k
curl -XGET "https://servername/nagiosxi/api/v1/obje ... key=apikey" -k
curl -XGET "https://servername/nagiosxi/api/v1/obje ... key=apikey" -k
Working queries:
curl -XGET "https://servername/nagiosxi/api/v1/obje ... y&pretty=1" -k
curl -XGET "https://servername/nagiosxi/api/v1/obje ... y&pretty=1" -k
Now if i try to add start-endtime, then empty result, i have tried with:
curl -XGET "https://servername/nagiosxi/api/v1/obje ... key=apikey" -k
curl -XGET "https://servername/nagiosxi/api/v1/obje ... key=apikey" -k
curl -XGET "https://servername/nagiosxi/api/v1/obje ... key=apikey" -k
curl -XGET "https://servername/nagiosxi/api/v1/obje ... key=apikey" -k
Re: query NagiosXI alarms
Not sure why these are failing but try it like so(keeping the epoch times and replacing apikey and server name accordingly):
curl -XGET "https://servername/nagiosxi/api/v1/obje ... key=apikey" -k
curl -XGET "https://servername/nagiosxi/api/v1/obje ... key=apikey" -k
If it is still failing, please open a ticket(https://support.nagios.com/ticket) and attach a profile(Admin > System Config > System Profile > Download System Profile).
curl -XGET "https://servername/nagiosxi/api/v1/obje ... key=apikey" -k
curl -XGET "https://servername/nagiosxi/api/v1/obje ... key=apikey" -k
If it is still failing, please open a ticket(https://support.nagios.com/ticket) and attach a profile(Admin > System Config > System Profile > Download System Profile).
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.