[collectd] tail plugin - CounterInc bug?

Daniel Hilst danielhilst at gmail.com
Mon Apr 9 13:34:22 CEST 2012


I'm using tail on a file, with CounterInc DS, counter type and "foo" as 
match. My file is named table.txt.

Collectd is configured with 10 secs of interval. When I do not fill the 
file with foo's I got 0's as I expect.

When I fill file first time `echo foo >> table.txt' I expect 0.01 as 
wiki said[1] on derive formula (Vn - Vo / 10), since there is no 
wrapping around in this case. After the 0.01 I expect 0 again since I 
have not filled the file again, but I got 0.09.. This second value is 
always 9 times greater the first one.

So if I fill the file with 3 foo's I get 0.03 first and then 0.27 after. 
It may be a bug?

Here is how to reproduce this:
1) Place this configuration on your collectd.conf and enable tail plugin
<Plugin "tail">
   <File "/SOME/PATH/table.txt">
     Instance "table_test"
     <Match>
       Regex "foo"
       DSType "CounterInc"
       Type "counter"
       Instance "total"
     </Match>
   </File>
</Plugin>

2) Start collectd
3) Go to table-tail_test (In my case 
/opt/collectd/var/lib/collectd/localhost/tail-table_test)
4) Let this chain running on this terminal:
while :; do rrdtool fetch counter-total.rrd AVERAGE -s -1h | tail | sed 
's/://' | awk '{printf("%s;;; %f\n", strftime("%c", $1), $2);}'; sleep 
1; clear; done
5) Open other terminal
6) On new terminal do:
echo foo >> table.txt
and see the result on first terminal

Here is some sample output:
Mon 09 Apr 2012 11:27:00 AM UTC;;; 0.000000
Mon 09 Apr 2012 11:27:10 AM UTC;;; 0.000000
Mon 09 Apr 2012 11:27:20 AM UTC;;; 0.000000
Mon 09 Apr 2012 11:27:30 AM UTC;;; 0.000000
Mon 09 Apr 2012 11:27:40 AM UTC;;; 0.010000
Mon 09 Apr 2012 11:27:50 AM UTC;;; 0.090000
Mon 09 Apr 2012 11:28:00 AM UTC;;; 0.000000
Mon 09 Apr 2012 11:28:10 AM UTC;;; 0.030000
Mon 09 Apr 2012 11:28:20 AM UTC;;; 0.270000
Mon 09 Apr 2012 11:28:30 AM UTC;;; nan


Thanks in advance!


[1] http://www.collectd.org/wiki/index.php/Derive
-- 
Follow the white rabbit!



More information about the collectd mailing list