[rrd-developers] Patch to get more metadata out of 'rrdtool graph'

Mark Plaksin happy at usg.edu
Mon Sep 24 21:24:13 CEST 2007


Tobias Oetiker <tobi at oetiker.ch> writes:

> Hi Mark,
>
> I will be glad to accept such a patch ... BUT ... it has to be done
> differently.
>
> rrd_graph may not print anyting directly. it must return its
> information to the caller who is then responsible for dealing with
> it ... look how this is done currently for the size of the graph
> and the return data for PRINT: ... unfortunately this code does not
> realy lend it self to extension, so I guess what would have to be
> done, is to add an option to rrdtool which enables a different kind
> of return values ... (this is necessary to  NOT break existing
> code).
>
> have a look at rrd_info.c to see what kind of interface for
> returning arbitrary data I would like to see ...
>
> in that way  rrdtool could retorn a ton of data about the graph and
> all its properties to the caller ...

Hi Tobi:

Sorry for the delay.

If I understand you correctly this plan is OK; is it?

- Add a command-line option to 'rrdtool graph' which turns on the
display of graph metadata.  Add a similar argument to the rrd_graph C
function.

- Create graph_push() (or (ab)use info_push()) and use it inside of
rrd_graph() to collect information about the graph.

- Modify the calls to rrd_graph to respect the command-line argument and
print the data rrd_graph returns.

- And add a command-line option to 'rrdtool graph' which allows you to
specify the scale (just like '-2' does in my original patch).

> cheers
> tobi
>
> Yesterday Mark Plaksin wrote:
>
>> Here's a small patch against the 1.3 trunk which makes life easier for
>> my buddy's Google Maps-like web interface to RRDs.  It's Google
>> Maps-like in that you can drag the graph part of the image left and
>> right in time.  Demo site & code coming soon.
>>
>> The patch adds three options to the 'rrdtool graph' command-line:
>>
>> a) '-1' makes rrdtool display the scale (im->minval,im->maxval) of the
>> graph.  This is used by the next option.  Sample output:
>> 	scale: 0.00,99.00
>>
>> b) '-2 MIN,MAX' forces the scale to MIN and MAX.  To force the scale to
>> be what was returned in the example above you would use:
>> 	rrdtool graph -2 0.00,99.00
>>
>> c) '-3' Display the coordinates of the upper-left corner of the graph
>> part of the image and the length and height of the graph (in pixels).
>> Sample output:
>> 	graph_coords: 57,30,400,100
>>
>> Obviously argument names are random :)
>>
>> Would you add this or something like it?  It might be helpful to be able
>> to get arbitrary properties of the graph and/or image out via the
>> command-line but these three options are doing the trick for us at the
>> moment.
>>
>> Thanks & thanks for RRDtool!
>>
>> PS:  I have a patch against 1.2 also; let me know if you like that too/instead.
>>
>>
>
> -- 
> Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten
> http://it.oetiker.ch tobi at oetiker.ch ++41 62 213 9902



More information about the rrd-developers mailing list