Pull data from graph

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
antifaction
Posts: 24
Joined: Fri Oct 05, 2007 2:12 pm

Pull data from graph

Post by antifaction »

I would like to pull data from a graph and get it into a perl script.

Some of my graphs have the 95th commented on them. I would like to be able to pull this value into a script so I can check them at the end of the month.

The value I want is "COMMENT: Billing 95th: |95:bits:6:aggregate:2| Mbps"


Can anyone point in the right direction?

Thank you.
cacti 0.8.7d
linux
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

You can use the csv export feature OR access the raw data inside the associated RRD file (rrdtool dump or fetch commands).
antifaction
Posts: 24
Joined: Fri Oct 05, 2007 2:12 pm

Post by antifaction »

The raw data is not inside the rrd file. It's calculated by cacti.

I'm trying to use the graph_xport.php file to pull the information out but I'm having a lot of trouble.

I added this to the code:

$_GET["graph_start"]=$argv[0]
$_GET["graph_end"]=$argv[1]
$_GET["graph_height"]=$argv[2]
$_GET["graph_width"]=$argv[3]
$_GET["local_graph_id"]=$argv[4]
$_GET["rra_id"]=$argv[5]

and then tried to run:

# php cli_graph_xport.php 1239219376 1239222976 300 500 31077 0
PHP Parse error: syntax error, unexpected T_VARIABLE in /var/www/cacti-0.8.7b/cli_graph_xport.php on line 43


line 43 is my "$_GET["graph_end"]=$argv[1]"

If anyone can help me out I would appreciate it. I'll keep playing with the php file in the mean time and post if I get anything working.
cacti 0.8.7d
linux
antifaction
Posts: 24
Joined: Fri Oct 05, 2007 2:12 pm

Post by antifaction »

I looked into this more and the graph export does not include the extra comments that I add to the graphs. it won't show me the |95:bits:6:aggregate:2| at all in the export.

Any other ideas to getting this data? Is there any way to have rrdtool dump text output? Also can anyone help me find the code in cacti that produces the 95th calculations?

If not does anyone have any other ideas?

Thank you.
cacti 0.8.7d
linux
antifaction
Posts: 24
Joined: Fri Oct 05, 2007 2:12 pm

Post by antifaction »

I'm still trying to find a solution for this. The problem is that the |95:bits:6:aggregate:2| comment is only shown on the graph. it is not in the cvs outport or in the raw data. I could get the raw data and then do some math and get the value that way. But I have lots of aggregate graphs and this method would be to hard to maintain. Does anyone know the cacti code to do the 95th? I'm been trying to read though the .php files to figure out how this works.

If I could get a .php file that would accept a variable like local_graph_id and then print out the COMMENT lines (sort of like how debug mode (Turn on graph debug mode) works in the graphs.php file) that would be perfect.

I'll keep hacking up code and breaking things until I get it. I'll post anything useful I find here.

Thank you.
cacti 0.8.7d
linux
antifaction
Posts: 24
Joined: Fri Oct 05, 2007 2:12 pm

Post by antifaction »

I think this is what I want...

I just need to get all the things it needs and I should ok.

<span class="textInfo">RRDTool Command:</span><br>
<pre><?php print rrdtool_function_graph(34203, 1, $graph_data_array);?></pre>
<span class="textInfo">RRDTool Says:</span><br>
<?php unset($graph_data_array["print_source"]);?>
<pre><?php print rrdtool_function_graph(34203, 1, $graph_data_array);?></pre>
cacti 0.8.7d
linux
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests