[collectd] plugin for CurrentCost energy monitor

Robert McQueen robot101 at hadesian.co.uk
Tue Apr 26 00:19:42 CEST 2011

Hi all,

I've written the attached simple Python plugin to read the XML output
from a CurrentCost CC128 home power monitoring device, as documented here:

I've got a few questions:

1. Any feedback? I'm new to collectd and a little rusty in Python, so
any suggestions gratefully received.

2. The readings come in from the CurrentCost device whenever it decides,
which seem to be in the range of every 6 - 12 seconds, rather than every
10 seconds. My plugin keeps only the last reading until collectd calls
the read function, which means sometimes two readings arrive in a 10
second interval and one is lost, and sometimes no reading is delivered
(often just before/after). This of course means I'm losing a little
accuracy. Would it be better/acceptable to just ignore the interval and
deliver the readings whenever they arrive, and let god^WRRD sort it out?

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?

Many Thanks,

P.S. I've got a couple more questions but they're more about Python than
collectd - namely whether I need the lock at all - and whether I can do
without the 100ms timeout to check if self.run has been set to False by
the shutdown method.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: currentcost.py
Type: text/x-python
Size: 2756 bytes
Desc: not available
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20110425/818529c1/attachment.py>

More information about the collectd mailing list