[rrd-users] Measuring rain from weatherstation

Simon Hobson linux at thehobsons.co.uk
Mon Dec 8 11:21:10 CET 2014

Alex van den Bogaerdt <alex at vandenbogaerdt.nl> wrote:

> As before: don't write to RRDtool unless the value tipped over to the next number.  There won't be spikes. The amount of rain will be divided by the amount of seconds since the last update.

So use derive data type, write 0.5 (or any larger value that's accumulated) followed by 0 whenever the counter tips over ?
Guess we need to write 0 periodically to avoid getting long periods of unknown.

So we end up with :

  read value
  if value > min
    reset counter
    reset timer
    write T:value to rrd
    writeT+1:0 to rrd
    if timer > some_period
    write T:0 to rrd
    reset timer
  sleep for a bit
go back and do it all again

More information about the rrd-users mailing list