[rrd-developers] Re: (bug?) Incorrectly selecting low-res RRA

Alex van den Bogaerdt alex at ergens.op.het.net
Thu Mar 27 18:37:32 MET 2003

```On Thu, Mar 27, 2003 at 05:04:31PM +0000, Phil Radden wrote:
> On Thu, 27 Mar 2003, Alex van den Bogaerdt wrote:
> > Look at the time in seconds since the epoch.  Check both "--start"
> > and "--end", looking for:
> >
> > a)  a whole multiple of {step*steps} in any of your RRAs
> > b)  as in (a), but offset by -1*step
> > c)  as in (a), but offset by +1*step
> >
> > Test this, on a small section of the database.
>
> Hi Alex,
>
> Many thanks for your mail, but I'm afraid I'm having a little trouble
> understanding what you're suggesting I try.
>
> The rrds I'm using have rras with (step, steps) being:
>   15, 240		(hour)
>   360, 240		(day)
>   2520, 240		(week)
>   10080, 240		(month)
>   86400, 370		(year)
>   259200, 370		(three years)
>   864000, 370		(decade)
> and it appears that
>   rrdtool fetch transfers.rrd AVERAGE -s -2419200 -e N
> is sometimes picking the fifth (year) instead of fourth (month) (where
> 2419200 is 10080x240, of course).

No: you don't have RRAs with step being other than 15.
You could write:  ... with (steps, rows) being...

more remarks at the bottom, at [X]

> rra[1].rows = 240
> rra[1].pdp_per_row = 24
24 steps per row, 240 rows

Each interval starts at n*15*24 and ends at (n+1)*15*24

> rra[2].rows = 240
> rra[2].pdp_per_row = 168
168 steps per row, 240 rows

Each interval starts at n*15*168 and ends at (n+1)*15*168

> So I'm guessing you mean beware of N being a multiple of 2419200 (or the
> others)?  I'm now logging

Not "beware".  I'm just pointing out that there could be something
in the RRA selection process that doesn't behave the way you expect
it to.

Example:

Two RRAs.  One with steps=1, one with steps=2.  RRD has "step == 15".

RRA1:

(n+0)*15:   10
(n+1)*15:   20
(n+2)*15:   15
(n+3)*15:   25
(n+4)*15:   35
(n+5)*15:    5

This covers 6*15=90 seconds.

RRA2:

(m+0)*30:   15
(m+1)*30:   20
(m+2)*30:   20

This also covers 90 seconds.

Suppose you ask for "--end (n+6)*15" "--start end-90sec", you expect
rrdtool to return 6 rows.

However, since "(n+6)*15" equals "(m+3)*30", it *MAY* be possible that
RRDtool decides to return rows from the lower resolution RRA.

If you use "--end now" or (oh horror) "--end now-1minute" things get worse.
Sometimes you will have specified a time that matches the boundaries of
the RRA (and RRDtool will return "(m+0)*30" to "(m+3)*30") but in most
cases this will not be so and RRDtool will return the closest match (which
will be the lowest resolution RRA).

This is because of the yet-to-be-archived-partially-filled-timeslot that
currently is being prepared and which will be available when the time is
a whole multiple of your step*steps time *and* an update is done.

[X]
> and it appears that
>   rrdtool fetch transfers.rrd AVERAGE -s -2419200 -e N
> is sometimes picking the fifth (year) instead of fourth (month) (where
> 2419200 is 10080x240, of course).

No need to fetch 2419200 seconds of data.  In fact, this will probably
cause problems as RRDtool will have to do its best to make a closest
match to what you really "want" (read: do not want but specify)

The value of "N" is important.
>   10080, 240		(month)
>   86400, 370		(year)

If "N" is not a multiple of 10080 and if the amount of rows in the
"month" RRA is not enough to provide 2419200 seconds worth of data
(and it will not be enough in that case!) maybe the "year" RRA can
provide a better match.

Try specifying "--end xxx" with xxx being a multiple of 10080.
The amount of rows should be low.  For instance:

...fetch...  --start end-50400 --end 1048783680

Now do the same query with "--start end-2419200" and adjust
the end time to be the largest number being a whole multiple
of 10080 but not being later than "now".

Then do the same exercise with some number that is a multiple
of 86400.  You should see the pattern eventually.

HTH
Alex

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

```

More information about the rrd-developers mailing list