Hi Henrick, > I noticed this when looking into a problem one of my Hobbit users > reported today. It seems that when you define a DS as a COUNTER, > then it will only accept updates with integer values - except for > the first time: > > $ rrdtool create foo.rrd DS:virt:COUNTER:600:0:U RRA:AVERAGE:0.5:1:600 > $ rrdtool update foo.rrd N:10.5 > $ rrdtool update foo.rrd N:10.5 > ERROR: not a simple integer: '10.5' > > It kind of makes sense that a counter must be an integer, but why does > the first update work ok ?
you are right ... the check in the code only kicked in when the previous update was ! U ... r1171 has the fix ... > > In comparison, GAUGE datasets work fine (of course): > $ rrdtool create bar.rrd DS:virt:GAUGE:600:0:U RRA:AVERAGE:0.5:1:600 > $ rrdtool update bar.rrd N:10.5 > $ rrdtool update bar.rrd N:10.5 > $ rrdtool update bar.rrd N:10.5 > > > On a slightly related note, is there any way you can ask rrdtool > to treat both dot and comma as decimal separators ? > > $ rrdtool update bar.rrd N:10,5 > ERROR: conversion of '10,5' to float not complete: tail ',5' > > Comma is the decimal separator in some locales (e.g. danish), so > "10,5" should be valid. > > hobbit$ export LANG=da_DK > hobbit$ rrdtool update bar.rrd N:10,5 > ERROR: conversion of '10,5' to float not complete: tail ',5' > $ printf '%f\n' 10.5 > -bash: printf: 10.5: invalid number > 0,000000 > $ printf '%f\n' 10,5 > 10,500000 the problem is that useing , as a decimal separator will lead to problems with RPN syntax ... so what I did for 1.3 is that I make sure we are always in LC_NUMERIC C when doing scanf for floats ... the reasoning behind this is that in a C or Java program you also have to write your numbers with . ... cheers tobi > Regards, > Henrik > > _______________________________________________ > rrd-developers mailing list > [email protected] > https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers > > -- Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten http://it.oetiker.ch [EMAIL PROTECTED] ++41 62 213 9902 _______________________________________________ rrd-developers mailing list [email protected] https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers
