[collectd] plugin for CurrentCost energy monitor
Luke Heberling
collectd at c-ware.com
Thu Apr 28 22:08:41 CEST 2011
Robert,
Hey that's a neat little gadget. The thought of XML over serial makes me
gag a little though. :)
To solve this problem, I think that rather than dispatch each reading
that is received, you should provide the last reading to collectd
whenever your plugin is queried. I also think you can get rid of the
locking. In your main loop, just stuff the value received in a map
against the channel number. In plugin_read, report the most recent value
for all channels. If you are concerned about the possibility of
overwriting a reading before it is sent to collectd, you could do the
averaging before handing it off (which may introduce a need for
locking), but you must report something whenever you're queried for a
read if you want to avoid the NaN values.
Luke Heberling
More information about the collectd
mailing list