[rrd-developers] [rrd-users] [GRAYMAIL] Re: Block GPRINT when values not defined?

Steve Shipway s.shipway at auckland.ac.nz
Wed May 14 05:55:12 CEST 2014


> That sounds interesting and useful but not what we both asking for.
> I would be happy with unknown dates printing nothing at all, padded to the
> size of the requested format. What the OP complained about was the when
> the value is undefined/Unknown/NaN,  strftime prints 1/1/1970 which would
> be correct if the date were known and it’s value was 0. For me at -5 UTC so
> it’s always New Years Eve (unless my disk array is going to run out of space
> then it’s 2014 ☹.

I've just taken a quick look at rrd_graph.c in v1.4.tunk and it seems that this should already be happening.

The function sets vf.never=1 when the time component is unknown,  and if this is the case, then GPRINT should call time_clean rather than strtime and so you should get blank when the time would go.  I can't see why you'd get it treated as 0, unless either you have an old version of RRDTool (which didn't have this check) or else there is a bug and vf.never is not getting set.

Possibly the code should treat a zero timeval as 'unknown', since who would want to print the date of the epoch anyway..?

If you're running on an older version of RRDTool, I'd suggest upgrading to the latest stable 1.4.  You might find the problem goes away.

I do still like the idea of adding an option to GPRINT to specify an RPN test controlling if the print is added to the image or not; this would give a lot more control over the output.  It's a bit complex for me to code up, though...

Steve

Steve Shipway
s.shipway at auckland.ac.nz


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5909 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20140514/6e02d6fc/attachment.bin 


More information about the rrd-developers mailing list