Need help using graphing API

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Need help using graphing API

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Need help using graphing API

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Need help using graphing API

Post 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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Need help using graphing API

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked