I am trying to pull down some service stats and parse the results into a report. I can pull down the data I want from the cgi-bin, but the result is a file that is downloaded to my computer. Is there anyway to read the data directly without creating the file? Or is there a way to pull the same information in JSON format? We are on XI 2012R2.8c.
Thanks
Get stats programmatically
Re: Get stats programmatically
So I found this when looking at the backend API.
http://<nagios server>/nagiosxi/backend/?cmd=getservicestatus&username=user&ticket=number
The results are in XML but it gives me every service. This there a way to pass different parameters to the backend API?
http://<nagios server>/nagiosxi/backend/?cmd=getservicestatus&username=user&ticket=number
The results are in XML but it gives me every service. This there a way to pass different parameters to the backend API?
Re: Get stats programmatically
One more thing. I see everything I need except for availability. Can this be pulled from a different URL?
-
dwhitfield
- Former Nagios Staff
- Posts: 4583
- Joined: Wed Sep 21, 2016 10:29 am
- Location: NoLo, Minneapolis, MN
- Contact:
Re: Get stats programmatically
There are a lot of new features in 2014, and of course we just released 5.3.2. Any reason keeping you from upgrading?maltman wrote:We are on XI 2012R2.8c.
Also, since your system is old, what OS are you running? CentOS 5 runs out of support in March. When you upgrade your OS might be a good time to upgrade Nagios.
Re: Get stats programmatically
I noticed that the version was really old as well. I have brought this up but I am not sure when we will upgrade it. The OS is 6.3. Not sure why Nagios wasn't updated when the OS was.
I will continue to try getting it updated so I can use the REST API but until then, is there anything that I can do with the backend API? getservicestatus is good except I need availability data for my services. I can parse the XML also if there is no possibility of JSON.
I will continue to try getting it updated so I can use the REST API but until then, is there anything that I can do with the backend API? getservicestatus is good except I need availability data for my services. I can parse the XML also if there is no possibility of JSON.
Re: Get stats programmatically
You can append &name= to specify exactly which data set you are looking for. As an example - http://192.168.3.115/nagiosxi/backend/? ... escalation
Former Nagios Employee
Re: Get stats programmatically
It looks like that gives the same type of information. It is good as it contains execution time, latency, performance data, etc. but I was hoping to find something with availability percentage of the services.
We have it set up with a host and several services under that host which we can then pull into a report. We are achieving this right now with a call to cgi-bin but I don't like this as it triggers a file download and the file is in HTML format. But the availability data is stored in there.
I guess, long story short, is there a way to get the availability report through the backend API?
We have it set up with a host and several services under that host which we can then pull into a report. We are achieving this right now with a call to cgi-bin but I don't like this as it triggers a file download and the file is in HTML format. But the availability data is stored in there.
I guess, long story short, is there a way to get the availability report through the backend API?
-
avandemore
- Posts: 1597
- Joined: Tue Sep 27, 2016 4:57 pm
Re: Get stats programmatically
JSON query generator has some of this capability: http://<Your Nagios Host>/nagios/jsonquery.html
The new api also You can do something like XI > Help > GET objects/statehistory and roll your own availability report.
The API is extendable, you are able to pursue that option as well. See Help > Custom API Endpoints.
Also we offer custom development services for a fee. Let us know if you are interested in that option.
The new api also You can do something like XI > Help > GET objects/statehistory and roll your own availability report.
The API is extendable, you are able to pursue that option as well. See Help > Custom API Endpoints.
Also we offer custom development services for a fee. Let us know if you are interested in that option.
Previous Nagios employee
Re: Get stats programmatically
Thank you for the reply. I do not see the Custom API Endpoints in the Help screen from our portal. Is there another way to access this?
-
avandemore
- Posts: 1597
- Joined: Tue Sep 27, 2016 4:57 pm
Re: Get stats programmatically
I believe the version you're using doesn't support the newer API. You would need to upgrade.
Previous Nagios employee