[rrd-users] Assign RRDGraph DEF variables to external variable?
Steve Shipway
s.shipway at auckland.ac.nz
Sun Jun 22 07:02:09 CEST 2014
There are a couple of issues here.
Firstly, you are misunderstanding the use of MAX in a DEF. What this means is that you will get the MAX-type RRA, which holds the maximum value over the consolodated interval as a series -- what I think you want is the maximum value over the entire series? In this case, you need to use a VDEF.
Secondly, the LINE2 directive will print out the legend line, if you have a description, but without a newline. So, you can easily append to it with a subsequent directive. So, for example:
"DEF:test:test.rrd:sum:AVERAGE"
"VDEF:testmax:test,MAXIMUM"
"LINE2:test#00FF00:Test Graph, Max value="
"GPRINT:testmax:%6.2lf"
"COMMENT:\\l"
The COMMENT directive is to force a left-justified newline after printing the legend and the maximum value.
Steve
Steve Shipway
University of Auckland ITS
UNIX Systems Design Lead
s.shipway at auckland.ac.nz<mailto:s.shipway at auckland.ac.nz>
Ph: +64 9 373 7599 ext 86487
________________________________
From: Md. Ali Ahsan Rana [aliahsanrana at gmail.com]
Sent: Sunday, 22 June 2014 12:27 p.m.
To: Steve Shipway; linux at thehobsons.co.uk
Cc: rrd-users at lists.oetiker.ch
Subject: Re: [rrd-users] Assign RRDGraph DEF variables to external variable?
Thanks Steve and Simon for your reply. I get the idea, thanks. However, my current need is little simpler one. I want the value to be shown as part of the title, such as:
$series = "DEF:'test'='$rrd_dir/test.rrd':'sum':AVERAGE "
. "DEF:'max'='$rrd_dir/test.rrd':'sum':MAX "
."LINE2:test#00FF00:'Test Graph, Max Value={max} ' "
As you can see, I want to print the max value of the same data set as part of title. I guess its achievable without calling rrdgraph twice? Can you please give a clue how? Thanks.
Regards
Rana
On Sat, Jun 21, 2014 at 6:17 PM, Steve Shipway <s.shipway at auckland.ac.nz<mailto:s.shipway at auckland.ac.nz>> wrote:
If you wish to access the RRDTool data programmatically from PHP, then you have two options.
If you just want a few set values, you could call rrdtool using the PRINT directive to output text on stdout, and capture that, though you then have to parse the captured text.
If you want to access the entire data series, then you could call 'rrdtool fetch' or 'rrdtool xport' to obtain the data; also, you could install the PHP RRDtool library, and then access it directly from the PHP code rather than having to fork off a separate process and catch the output. This might be the most efficient way to achieve what you want.
Steve
Steve Shipway
University of Auckland ITS
UNIX Systems Design Lead
s.shipway at auckland.ac.nz<mailto:s.shipway at auckland.ac.nz>
Ph: +64 9 373 7599 ext 86487<tel:%2B64%209%20373%207599%20ext%2086487>
________________________________
From: rrd-users-bounces+s.shipway=auckland.ac.nz at lists.oetiker.ch<mailto:auckland.ac.nz at lists.oetiker.ch> [rrd-users-bounces+s.shipway=auckland.ac.nz at lists.oetiker.ch<mailto:auckland.ac.nz at lists.oetiker.ch>] on behalf of Md. Ali Ahsan Rana [aliahsanrana at gmail.com<mailto:aliahsanrana at gmail.com>]
Sent: Saturday, 21 June 2014 4:28 p.m.
To: rrd-users at lists.oetiker.ch<mailto:rrd-users at lists.oetiker.ch>
Subject: [rrd-users] Assign RRDGraph DEF variables to external variable?
Hello EveryOne,
I am constructing and executing rrdgraph command from php. A sample is as follows:
$series = "DEF:'test'='$rrd_dir/test.rrd':'sum':AVERAGE "
."LINE2:test#00FF00:'Test Graph' "
Now, I want the rrd variable 'test' to be assigned to an external php variable so that I can use that value for other task. How I can achieve this please?
Regards
Rana
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-users/attachments/20140622/237a03a1/attachment-0001.htm
More information about the rrd-users
mailing list