Page 1 of 1

Need help using graphing API

Posted: Fri Oct 11, 2013 5:08 pm
by Box293
I've just released the Performance Data Tool (PDT) however I need some assistance with accessing the graphing API.

One of the concepts behind the PDT is to be able to access performance data files for services that are now disabled. Because the services are no longer active in Nagios XI I am having trouble using the graphing API because I need to provide a service ID. For example the url is something like this:

Code: Select all

http://192.168.1.101/nagiosxi/perfgraphs/?&host=localhost&service=Current+Load&source=1&mode=2&service_id=87
However being a disabled service it no longer has a service ID. Is there a way to use the graphing API to access RRD files for services that are not enabled?

The place I need to be able to put the code into the PDT is in the file "performance_data_tool_display_contents.php" lines 86-92 (I'll probably need to create a function as well).

Any ideas how I can achieve this?

Cheers
Troy

Re: Need help using graphing API

Posted: Mon Oct 14, 2013 10:07 am
by abrist
I don't actually think the id is needed. I can pull up the images for the graphs with direct links. Try viewing the image only:

Code: Select all

https://x.x.x.x/nagiosxi/includes/components/perfdata/graphApi.php?host=localhost&service=&source=1&view=1
https://x.x.x.x/nagiosxi/includes/components/perfdata/graphApi.php?host=192.168.99.1&service=Input_%2F_Output_for_VMHost&source=3&view=1&start=&end=&rand=1381763163

Re: Need help using graphing API

Posted: Tue Oct 15, 2013 7:14 pm
by Box293
This didn't work unfortunately, when I remove the &service_id= line I get the message:
You are not authorized to access this feature. Contact your Nagios XI administrator for more information, or to obtain access to this feature.
One of the things I am trying to work out how to do I generate performance graphs for rrd files on the Nagios XI host. Specifically when a host and it's services are disabled the rrd files are left behind. After decomissioning a host, you sometimes need to access these files to look at the historical data as you might want to compare these to the new host that replaced it. Hence the Performance Data Tool does not use the build in Nagios XI functions to access the performance data files, it accesses the file system itself to look at what rrd files are available.

So my question is, how do I use the built in graphing API to access these rrd files?

Re: Need help using graphing API

Posted: Wed Oct 16, 2013 10:08 am
by abrist
Hmm. Works for me, though I was authenticated. Have you tried using the ticketids? I did and was able to pull the graph image remotely.
Box293 wrote: So my question is, how do I use the built in graphing API to access these rrd files?
You will have to do some source digging to discover the apis as they really are not documented. The files that you should start with are below - you may need to follow certain functions back through a few different files:
PNP:

Code: Select all

/usr/local/nagiosxi/html/includes/components/pnp/pnp.inc.php
Graph explorer:

Code: Select all

/usr/local/nagiosxi/html/includes/components/graphexplorer/fetch_rrd.php