[rrd-users] LAST of CDEF that converts NaN to 0 always 0

Matthew M. Boedicker matthewm at boedicker.org
Wed Jun 4 21:37:15 CEST 2008


Hi Tobi,

Thanks for the response. I'll update when the next version comes out.

I think I may have a possible workaround too using AVG. I have a bunch of DEFs
with random NaNs. I want a CDEF which is the sum of all of them with the NaNs
converted to 0, but for steps where every value is NaN, I want the sum in the
CDEF to be NaN and not 0. I check if all values are NaN by doing AVG and
checking if it's unknown. Since this extra step you mentioned is all NaN, it
drops out of the CDEF LAST and the result is correct.

On Wed, Jun 04, 2008 at 06:33:40PM +0200, Tobias Oetiker wrote:
> Hi Matthew,
> 
> there is a 'bug' in rrdtool graph, where it fetches one 'step' more
> data than is visible in the graph. This data is often 'nan'.
> 
> The LAST vdef shows you the last non NAN value. In normal operation
> this works fine, but if you first convert all NAN values to 0, LAST
> will show you zero since the last fetched value which was NAN was
> turned into zero.
> 
> anyway, I have fixed this problem in svn, in the next release of
> 1.2.x as well as 1.3.0 it is fixed, so that even when you turn nan
> to zero, you will get the last value visible on the graph.
> 
> 
> see http://oss.oetiker.ch/rrdtool-trac/changeset/1386
> 
> cheers
> tobi
> 
> Today Matthew M. Boedicker wrote:
> 
> > I have a DS x. I create a CDEF xz that is x with all NaN converted to 0. When
> > I use a VDEF to print the LAST of x it looks ok, but the LAST of xz is always
> > 0. If I graph a line of xz it looks fine. Does anyone know why this is
> > always 0 or another way I can do this that will work?
> >
> > rrdtool create test.rrd \
> > --start 1212566513 \
> > --step 3600 \
> > DS:x:GAUGE:7200:U:U \
> > RRA:AVERAGE:0.5:1:720
> >
> > rrdtool update test.rrd \
> > 1212570113:100 \
> > 1212573713:50 \
> > 1212577313:25 \
> > 1212580913:75
> >
> > rrdtool graph test.png \
> > --start 1212566513 \
> > DEF:x=test.rrd:x:AVERAGE \
> > CDEF:xz=x,UN,0,x,IF \
> > VDEF:xlast=x,LAST GPRINT:xlast:%lf \
> > VDEF:xzlast=xz,LAST GPRINT:xzlast:%lf
> >
> > _______________________________________________
> > rrd-users mailing list
> > rrd-users at lists.oetiker.ch
> > https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
> >
> >
> 
> -- 
> 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-users mailing list