[rrd-users] Re: using rrdtool with weather data

Alex van den Bogaerdt alex at slot.hollandcasino.nl
Thu Nov 2 00:22:22 MET 2000


Greg Satz wrote:

> I want to keep some historical data. However it appears the graphing
> function will consolidate data to fit on a particular graph. It doesn't make
> sense to keep data that will never be displayed. How do I determine
> reasonable disk space usage (number of samples) based on my graphing
> requirements (last month, last year, etc.)?

Just write down what you want to see.  As an example:  I would like to
view high-resolution data that is a month old (at most), I only want to
look at the big picture for historic data.  I graph temperatures and I
decided that one sample every 15 minutes is enough.

Result:  one RRA that contains 900-second samples.  The size is 31*24*4
samples (rounded up to 3000).  Graphs created from this data are 200
pixels wide so they display 50 hours worth of temperature at a time.

The other RRA contains 2-hour samples and thus displays just over two
weeks at a time.  It keeps two years of data: 2*365*24/2, rounded up
to 9000.  No need to generate another RRA that handles the yearly
graph, it can be build from this last RRA.  If I would look at this
graph frequently, I would probably create another RRA that is more
suitable for this graph, it should in that case show a year in 200
pixels --> I would show 400 days in 200 pixels, which is 2 days per
pixel so the RRA would contain 2-day {averages|maxima} and be of
size 400 (400 times 2 days == just over 2 years).

> Rain is a counter in that it increases. However it is nice to see the sum
> over a certain period of time. The consolidation functions all appear to
> interfere with the summation over time. How can I get the total rainfall out
> of rrdtool? Can I use a LAST RRA? How would I get total rainfall for the
> last year, month, day (assuming I keep that much data)?

If you average, you have an average over a certain amount of time.  If
you multiply the average and the amount of time, you end up with the total
amount.  Average is in "x/s"  (something per second), time is in "s",
multiply those and you end up with "x":  (x / s) * s  == x.

In other words, if you want to know the total rain from january 1st until
february 29th:
(this is 60 days or 60*86400 seconds)

   rrdtool graph dummy --start 20000101 --end 20000229 \
      DEF:rain=rain.rrd:amount:AVERAGE \
      CDEF:totalrain=rain,60,86400,*,* \
      PRINT:totalrain:AVERAGE:"%6.2lf mm"

> Wind speed could be a gauge or a counter. Total wind isn't very interesting
> so it doesn't have the same issue as rain. However it is nice to see
> maximums (gusting). It looks like the MAXIMUM consolidation function would
> keep this information. If the wind is a counter (wind rate), can I still get
> the absolute number (kph or mph)?

Yes, you can.  Just use DST==GAUGE and CF==MAX.
(I assume here that you ment to say it is a gauge value where you
said "If the wind is a counter..." as you were talking about a rate.)

> Wind direction seems to be the most challenging for rrdtool to accommodate.
> Wind direction can be broken down into 16 compass points. It would be nice
> to be able to show the maximum wind gust came from a certain direction. This
> would require a way to extract the data for a given time. It looks like
> rrdtool fetch will do this, wont it?

Perhaps you can use a DST per wind direction?  Granted, you will have
a big database but at least you can keep the stats you want.

something like
   rrdtool create wind.rrd \
      DS:n:GAUGE:600:0:300 \
      DS:nnw:GAUGE:600:0:300 \
      DS:nw:GAUGE:600:0:300 \
      DS:wnw:GAUGE:600:0:300 \
      DS:w:GAUGE:600:0:300 \
      DS:wsw:GAUGE:600:0:300 \
      ...
      RRA:AVERAGE:0.5:1:300 \
      RRA:MAX:0.5:1:300

Updating this RRD would be something like:
   rrdtool update wind.rrd --template wnw 112.56
   rrdtool update wind.rrd --template nw 109.23
(yes, its quite windy out here :)

Query the database, find the maximum, this will be in one of
16 datasources which are named after the wind direction.

> The difficult part for wind direction is the consolidation function.
> Averaging or max/min won't work. Looks like I need a "most common value"

If you keep 16 datasources, the problem isn't there anymore and you can
use min,max and average again!

Keep an extra datasource for wind speed alone; this makes programming
much more easy when you don't need to know the direction.

Perhaps I made an error somewhere in this mail but you got the picture!

HTH,
-- 
   __________________________________________________________________
 / alex at slot.hollandcasino.nl                  alex at ergens.op.het.net \
| work                                                         private |
| My employer is capable of speaking therefore I speak only for myself |
+----------------------------------------------------------------------+
| Technical questions sent directly to me will be nuked. Use the list. | 
+----------------------------------------------------------------------+
| http://faq.mrtg.org/                                                 |
| http://rrdtool.eu.org  --> tutorial                                  |
+----------------------------------------------------------------------+

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list