[rrd-developers] COUNTER values must be integer? And a locale issue

Henrik Stoerner henrik at hswn.dk
Tue Jul 24 12:45:04 CEST 2007


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 ?

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


Regards,
Henrik



More information about the rrd-developers mailing list