Page 2 of 2
Re: Get stats programmatically
Posted: Fri Nov 04, 2016 11:21 am
by maltman
Can this not be done with the backend API?
Re: Get stats programmatically
Posted: Fri Nov 04, 2016 12:15 pm
by avandemore
I don't understand why the json query is insufficient. It has availability information and is "programmatical". Perhaps there is some communication barrier, can you rephrase what you are looking for?
Re: Get stats programmatically
Posted: Fri Nov 04, 2016 2:49 pm
by maltman
yeah sorry about that.
So I am not sure when we will upgrade to the newest version. I am forced to use the backend API at the moment. I have used the getservicestatus command from the backend API to get all of performance data for my services. It is in XML but I can parse that out or convert it to JSON in my code.
The issue that I am having now is getting the availability data. It does not look like I can grab this from the backend API. I am using a call to
http://nagiosserver/nagios/cgi-bin/ avail.cgi?show_log_entries=&host=myhost
with time parameters to get the availability data at the moment. I was hoping there was an easier way as this is (in my opinion) much more difficult to parse plus I will need to define the time parameters in the URL instead of being able to sort through them in my code.
I can make the above work, I was just curious if there was anything else on older versions.
Re: Get stats programmatically
Posted: Mon Nov 07, 2016 10:47 am
by avandemore
Aside from the functionality differences, there are many other reasons to consider an upgrade. There are many reasons to upgrade and some not to. Just be aware if you chose not too you are running a version with known security and other issues.
If you decide to upgrade, remember make a backup first.
Re: Get stats programmatically
Posted: Mon Nov 07, 2016 4:19 pm
by maltman
So I just decided to pull the availability date and read it with HTML Agility Pack and then pull the Performance data from the Backend API. I can then compare the names and match up the data. Not ideal but it will work.
I am pushing for the upgrade but I am not sure when we will be able to get to it.
Thank you.
Re: Get stats programmatically
Posted: Mon Nov 07, 2016 4:21 pm
by dwhitfield
Is it ok to lock the thread, or would you prefer we leave it open for community input?
Re: Get stats programmatically
Posted: Tue Nov 08, 2016 11:28 am
by maltman
You can lock it. If anyone has any specific questions how I did this they can message me right?
Re: Get stats programmatically
Posted: Tue Nov 08, 2016 11:32 am
by avandemore
Yes member are free to PM each other sans blocklist. If you have new issues, please open a new thread.
Re: Get stats programmatically
Posted: Tue Nov 08, 2016 11:36 am
by maltman
Thank you.