[rrd-developers] Discuss regarding Ticket 263

Jean-Edouard Babin radius at gmail.com
Wed May 19 00:08:34 CEST 2010


Yesterday I opened a new ticked
http://oss.oetiker.ch/rrdtool-trac/ticket/263 because I got a wrong
output when printing time of an empty VDEF. (time is 1st Jan 1970)
I just find out why, in function vdef_calc of rrd_graph.c, cases
(VDEF_MAXIMUM, VDEF_AVERAGE, VDEF_FIRST, ...) set dst->vf.when to 0 if
value is unknow (which is my case).

I would be happy to try to do a patch, but I would like to discuss how
to do it before doing something. (I don't want to do something that
will not be commited because it's not a proper solution)

vdef struct is currently as follow:

typedef struct vdef_t {
    enum vdef_op_en op;
    double    param;    /* parameter for function, if applicable */
    double    val;      /* resulting value */
    time_t    when;     /* timestamp, if applicable */
} vdef_t;

My idea would be to add a new 'isnull' boolean variable to the struct,
so that in print_calc I could add some test on isnull be able to run
something else that strftime (let's say fct1()) when isnull is true.
fct1() would replace each %X values by '-'.
So "GPRINT:maxabc2:  Reach 100% @ %c :strftime" would print "Reach
100% @ -", "GPRINT:maxabc2:  Reach 100% @ %Y/%m/%d :strftime" would
print "Reach 100% @ -/-/-"

Do you have any comments about this idea ?

More information about the rrd-developers mailing list