# [rrd-users] creating a rrd database with specific RRAs

Simon Hobson linux at thehobsons.co.uk
Tue Aug 10 21:36:03 CEST 2010

```grewskee wrote:

>1. End goal is to graph the memory usage for a machine (free, cached, etc).
>I understand how to create the DS's.  I am using a step of 5 minutes (300
>seconds).  I only want to store a maximum of 3 days worth of data, as shown
>below.
>
>2. I would like to have graphs for:
>
>Hourly (1 minute average)
>Daily (5 minute average)
>3 days (30 minute average)
>
>3. For each of the above, I would also like to have the ability to determine
>the MAX value as well.
>
>Can anyone attempt to explain the formula needed to convert the above into
>RRAs?

Firstly, if you only store 5 minute sample periods, you cannot
display data at 1 minute resolution. Even if you enter data every
minute, it will be consolidated & normalised to 5 minute periods if
you specify 300s as the step time.

So, assuming you do want one minute resolution, you will need to set
your step time to 60s. For 3 days you can probably get away without
consolidation, so as a minimum you could probably get away with :
RRA:AVERAGE:0.5:1:4320

That means, consolidate 1 step time (Primary Data Point, PDP) per
Consolidated Data Point (CDP), and keep 4320 consolidated samples (60
minutes * 24 hours * 3 days). It doesn't matter which consolidation
function you use since for one sample, min=avg=max.

Alternatively, you could do :
RRA:AVERAGE:0.5:1:60
RRA:MAX:0.5:1:60
RRA:AVERAGE:0.5:5:288
RRA:MAX:0.5:5:288
RRA:AVERAGE:0.5:30:144
RRA:MAX:0.5:30:144

That means:
Consolidate 1 PDP per CDP and keep 60 value - that's one hour by one
minute intervals.
Consolidate 5 PDPs per CDP and keep 288 values - that's 5 minutes,
and (60/5 * 24) values.
Consolidate 30 PDPs per CDP and keep 144 values - that's 30 minutes,
and (60/30 * 24 * 3) values.

And for each of those, keep both an average and maximum value.

In practice, I would keep more data than that. If you try and graph
just a single data point beyond what you have stored, then you may
find you pull data from a lower resolution consolidation - eg you may
find that instead of getting an hour at 1 minute resolution, you get
5 minute chunks.

--
Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.

```