Get stats programmatically

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
maltman
Posts: 11
Joined: Thu Nov 03, 2016 2:58 pm

Re: Get stats programmatically

Post by maltman »

Can this not be done with the backend API?
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: Get stats programmatically

Post 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?
Previous Nagios employee
maltman
Posts: 11
Joined: Thu Nov 03, 2016 2:58 pm

Re: Get stats programmatically

Post 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.
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: Get stats programmatically

Post 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.
Previous Nagios employee
maltman
Posts: 11
Joined: Thu Nov 03, 2016 2:58 pm

Re: Get stats programmatically

Post 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.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Get stats programmatically

Post by dwhitfield »

Is it ok to lock the thread, or would you prefer we leave it open for community input?
maltman
Posts: 11
Joined: Thu Nov 03, 2016 2:58 pm

Re: Get stats programmatically

Post by maltman »

You can lock it. If anyone has any specific questions how I did this they can message me right?
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: Get stats programmatically

Post by avandemore »

Yes member are free to PM each other sans blocklist. If you have new issues, please open a new thread.
Previous Nagios employee
maltman
Posts: 11
Joined: Thu Nov 03, 2016 2:58 pm

Re: Get stats programmatically

Post by maltman »

Thank you.
Locked