[rrd-users] 3 questions

Alex van den Bogaerdt alex at vandenbogaerdt.nl
Fri Oct 14 00:30:44 CEST 2011

----- Original Message ----- 
From: "Shabnam Shahreza" <shabnam.shahreza at alpha-group.ca>
To: <rrd-users at lists.oetiker.ch>
Sent: Wednesday, October 12, 2011 8:08 PM
Subject: [rrd-users] 3 questions

Hi rrd-users;

I am new to rrdtool and have few questions:

> 1)      How can I draw only dots/pixels for the VDEF (MAXIMUM) values and not *line* or dashed line?
> I mean only one dot for the maximum value for start-to-end time period?

VDEF MAX returns not only a rate, also a time component. I think that currently you cannot use it directly, except in a (G)PRINT statement, so you will have to make a two-pass script, where the output of the first script is used to build the second script.

PRINT (not: GPRINT) the time at which a maximum occurs.  Catch it in a variable. Let's call it $x. In the 2nd script, you use this to limit the LINEx statement to draw only at that time.  Do so in a CDEF, something like (did not test, you do that): CDEF:new=old,DUP,TIME,$x,EQ,1,UNKN,IF,*
which should duplicate the current rate, get its time component, compares that time to your variable (in the script), if it is the same time, then multiply by 1 (a no-op) else by UNKN (making it unknown).

This is what should happen on the stack, if I did it correctly:

RRDtool VDEF will give you only one pair (rate,time), so if the same maximum happens more than once, you will get only one dot.

> 2)      And how can I compare different VDEF (MAXIMUMs) from several rrd files in one graph and pick
> the MAX of them? Do I need to create a new rrd file and extract the max from there?

How to do this has already been discussed, and you were also given the suggestion to do this outside RRDtool. I think that this is the best solution, you can do it while building the 2nd grapher script.

If you are already PRINTing the timestamps at which rates occur, then you may as well PRINT the corresponding rates, and do some script processing looking for the tuple (order,rate,time) which has the highest rate. You know in which order you PRINTed your datasources, so you know which has the highest rate, and can do the entire printing command in the 2nd graph command using COMMENT.

More information about the rrd-users mailing list