[collectd] Averaging Samples when SigRok provides higher resolution

Bert Vermeulen bert at biot.com
Wed Sep 25 16:51:25 CEST 2013

On 09/25/2013 04:22 PM, Kieran Bingham wrote:
> Hi Guys,
> We are using CollectD to record power consumption readings from a
> digital multimeter through Sigrok.
> The Multimeter has an update rate of 5Hz, but we are storing the data as RRD,
> which appears to be limited as 1Hz by its data storage format.
> We can overcome this easily by setting the MinimumInterval as shown below:
> <Plugin sigrok>
>   LogLevel 3
>   <Device "inlet_current">
>     Driver "agilent-dmm"
>     MinimumInterval 1
>     Conn "/dev/ttyUSB0"
>   </Device>
> </Plugin>
> However this means that we are losing resolution from our readings, as
> we are only storing a single sampling point out of 5.
> To enhance the data for our graphs, it was suggested to store the average
> of all of the readings per dispatch
> For example, I have implemented a patch to do this at :
> Is this something that is worth adding ?
> What are peoples initial thoughts, reviews, and reactions?

This suggestion has come up before, but I disagree with it.

- While you certainly do lose resolution by dropping measurements, averaging
doesn't really get you that resolution back. Any transient spikes that get
lost by measurement drops won't show up properly by averaging it all
together, either.

- The fact that you need to set MinimumInterval to 1 second because that's
as low as RRD goes, and that this is not good enough, just shows that RRD is
not the right tool for this particular job.

> Is there a better way to do this more generically across the code base?
> Perhaps for example - I should move the average functions to a util_avg.c

That would make this trivially available to other plugins as well, but I
think the two points above would hold for those cases as well.

Bert Vermeulen        bert at biot.com          email/xmpp

More information about the collectd mailing list