[collectd] plugin for CurrentCost energy monitor

Robert McQueen robot101 at hadesian.co.uk
Tue Apr 26 13:02:12 CEST 2011


On 25/04/11 23:19, Robert McQueen wrote:
> 3. This is running on a low-CPU ARM NAS box, and sometimes when under
> heavy CPU / disk load, several minutes go by without any values being
> logged. However, the other native plugins in collectd, disk, CPU,
> memory, etc all seem to log without problems. I find it hard to believe
> several minutes go by without my reader thread being scheduled while
> collectd continues working so I'm kind of confused. Any ideas?

I added some debug messages, it shows that while the device is dumping
its internal historical readings (which it does periodically) the
frequency of its normal readings goes down enough that we miss two in a row:

# two normal readings arrive, the later one is dispatched to collectd
Apr 26 11:03:51 mu collectd[9699]: currentcost: got
<msg><src>CC128-v1.29</src><dsb>00242</dsb><time>11:00:41</time><tmpr>24.0</tmpr><sensor>0</sensor><id>00506</id><type>1</type><ch1><watts>00134</watts></ch1><ch2><watts>00674</watts></ch2><ch3><watts>00086</watts></ch3></msg>#015
Apr 26 11:03:57 mu collectd[9699]: currentcost: got
<msg><src>CC128-v1.29</src><dsb>00242</dsb><time>11:00:47</time><tmpr>24.0</tmpr><sensor>0</sensor><id>00506</id><type>1</type><ch1><watts>00135</watts></ch1><ch2><watts>00658</watts></ch2><ch3><watts>00083</watts></ch3></msg>#015
Apr 26 11:03:59 mu collectd[9699]: currentcost: sending {0: {'ch1': 135,
'ch2': 658, 'ch3': 83}, 'tmpr': 24.0}

# no more readings arrive in 10s, nothing to send to collectd
Apr 26 11:04:09 mu collectd[9699]: currentcost: got no readings

# history stuff
Apr 26 11:04:10 mu collectd[9699]: currentcost: got
<msg><src>CC128-v1.29</src><dsb>00242</dsb><time>11:01:00</time><hist><dsw>00244</dsw><type>1</type><units>kwhr</units><data><sensor>0</sensor><h746>3.637<
/h746><h744>6.573</h744><h742>1.269</h742><h740>2.101</h740></data><data><sensor>1</sensor><h746>0.000</h746><h744>0.000</h744><h742>0.000</h742><h740>0.000</h740></data><data><sensor>2</sensor><h746>0.000</h746><h744>0.000</h744><h742>0.000</h742><h740>0.000</h740></data><data><sensor>3</sensor><h746>0.000</h746><h744>0.000</h744><h742>0.000</h742><h740>0.000</h740></data><data><sensor>4</sensor><h746>0.000</h746><h744>0.000</h744><h742>0.000</h742><h740>0.000</h740></data><data><sensor>5</sensor><h746>0.000</h746><h744>0.000</h744><h742>0.000</h742><h740>0.000</h740></data><data><sensor>6</sensor><h746>0.000</h746><h744>0.000</h744><h742>0.000</h742><h740>0.000</h740></data><data><sensor>7</sensor><h746>0.000</h746><h744>0.000</h744><h742>0.000</h742><h740>0.000</h740></data><data><sensor>8</sensor><h746>0.000</h746><h744>0.000</h744><h7

# 10s later, still nothing for collectd
Apr 26 11:04:19 mu collectd[9699]: currentcost: got no readings

# more history
Apr 26 11:04:20 mu collectd[9699]: currentcost: got
<msg><src>CC128-v1.29</src><dsb>00242</dsb><time>11:01:10</time><hist><dsw>00244</dsw><type>1</type><units>kwhr</units><data><sensor>0</sensor><h738>2.416<
/h738><h736>6.912</h736><h734>3.403</h734><h732>1.367</h732></data><data><sensor>1</sensor><h738>0.000</h738><h736>0.000</h736><h734>0.000</h734><h732>0.000</h732></data><data><sensor>2</sensor><h738>0.000</h738><h736>0.000</h736><h734>0.000</h734><h732>0.000</h732></data><data><sensor>3</sensor><h738>0.000</h738><h736>0.000</h736><h734>0.000</h734><h732>0.000</h732></data><data><sensor>4</sensor><h738>0.000</h738><h736>0.000</h736><h734>0.000</h734><h732>0.000</h732></data><data><sensor>5</sensor><h738>0.000</h738><h736>0.000</h736><h734>0.000</h734><h732>0.000</h732></data><data><sensor>6</sensor><h738>0.000</h738><h736>0.000</h736><h734>0.000</h734><h732>0.000</h732></data><data><sensor>7</sensor><h738>0.000</h738><h736>0.000</h736><h734>0.000</h734><h732>0.000</h732></data><data><sensor>8</sensor><h738>0.000</h738><h736>0.000</h736><h7

# two readings, the later one dispatched to collectd
Apr 26 11:04:22 mu collectd[9699]: currentcost: got
<msg><src>CC128-v1.29</src><dsb>00242</dsb><time>11:01:11</time><tmpr>24.0</tmpr><sensor>0</sensor><id>00506</id><type>1</type><ch1><watts>00136</watts></ch1><ch2><watts>00881</watts></ch2><ch3><watts>00096</watts></ch3></msg>#015
Apr 26 11:04:28 mu collectd[9699]: currentcost: got
<msg><src>CC128-v1.29</src><dsb>00242</dsb><time>11:01:17</time><tmpr>24.0</tmpr><sensor>0</sensor><id>00506</id><type>1</type><ch1><watts>00138</watts></ch1><ch2><watts>00880</watts></ch2><ch3><watts>00092</watts></ch3></msg>#015
Apr 26 11:04:29 mu collectd[9699]: currentcost: sending {0: {'ch1': 138,
'ch2': 880, 'ch3': 92}, 'tmpr': 24.0}

What I don't understand is why missing two readings means that RRD loses
four - from a dump of the temperature readings during that time:

<!-- 2011-04-26 11:03:30 BST / 1303812210 -->
<row><v>2.4000000000e+01</v></row>
<!-- 2011-04-26 11:03:40 BST / 1303812220 -->
<row><v>2.4000000000e+01</v></row>
<!-- 2011-04-26 11:03:50 BST / 1303812230 -->
<row><v>2.4000000000e+01</v></row>
<!-- 2011-04-26 11:04:00 BST / 1303812240 --> <row><v>NaN</v></row>
<!-- 2011-04-26 11:04:10 BST / 1303812250 --> <row><v>NaN</v></row>
<!-- 2011-04-26 11:04:20 BST / 1303812260 --> <row><v>NaN</v></row>
<!-- 2011-04-26 11:04:30 BST / 1303812270 --> <row><v>NaN</v></row>
<!-- 2011-04-26 11:04:40 BST / 1303812280 -->
<row><v>2.4000000000e+01</v></row>
<!-- 2011-04-26 11:04:50 BST / 1303812290 -->
<row><v>2.4000000000e+01</v></row>
<!-- 2011-04-26 11:05:00 BST / 1303812300 -->
<row><v>2.4000000000e+01</v></row>

Any clues? Should I just dispatch every reading into collectd when it
arrives and let RRD average them out?

Thanks,
Rob



More information about the collectd mailing list