[rrd-users] Re: choosing an RRA for graph generation

Chris Robb chrobb at indiana.edu
Mon Dec 16 21:11:27 MET 2002


Thanks for the summary of the issues. I thought I'd share the perl code I
used to get the values:

----
# weekly RRDs with 30 minute averages
$weekEnd = (int($currentEpoch / 1800)) * 1800;
$weekStart = $monthEnd - (86400 * 7);

# monthly RRDs with 2 hour averages
$monthEnd = (int($currentEpoch / 7200)) * 7200;
$monthStart = $monthEnd - (86400 * 30);

# monthly RRDs with daily averages
$yearEnd = (int($currentEpoch / 86400)) * 86400;
$yearStart = $yearEnd - (86400 * 365);
---

Just key your graphs off these start/stop times and things will
work beautifully.

Note that I didn't have to select a certain number of pixels as Alex
suggests. I'm not sure if that's luck or not.

-Chris

Chris Robb
Indiana University Global NOC
Abilene/TransPAC Network Engineer
chrobb at iu.edu  Desk: 812-855-8604 Cell: 812-325-8199

On Sat, 14 Dec 2002, Alex van den Bogaerdt wrote:

>
> On Fri, Dec 13, 2002 at 04:14:32PM -0500, Chris Robb wrote:
>
> > I upsized the RRD files about two weeks ago. This inserts empty 5 minute
> > data for the prior 2 years. When RRD chooses the RRA to look at when doing
> > a yearly graph, it appears to be looking at the 5 minute data, solely, and
> > not the daily averages. This makes it look like there's no data collected
> > before the day I upsized, which isn't true.
>
> Oh yes it is true.  Well, it is *unknown* data.
>
> *You* ask for data that isn't there yet.  RRDtool does NOT know what
> the rates were say 1 year ago.  It does know what the average rate was
> in a 1-day resolution but *you* ask for daily averages.
>
> How do you do that?  RRDtool tries to do a >>>best match<<<.
>
> In case you query the database at 00:00 UTC (!) exactly (!) and ask
> for a time period that exactly (!) matches the number of pixels in
> your graph, RRDtool *will* use the "yearly" RRA.
>
>
> - Determine which RRA you want to use
> - Detemine the number of seconds per CDP in this RRA (the "yearly" RRA
>   will have 86400 seconds, the "weekly" will have 1800 per CDP). Let's
>   call this number "t".
> - Determine how much of those CDPs you want to show.  For instance,
>   400 would be a nice number.  You'd be displaying 400 days, or 400
>   half hours.  Let's call this number "w".
> - Set "--width" to "w"  ("--width 400").
> - Set "--start" to "end" - w * t (so: 400*86400: "--start end-34560000")
> - Determine the current time in seconds since the epoch, then find the
>   nearest time which is stored in the RRA.  For instance:
>     current time:              1039868723
>     integer divide by 86400:        12035
>     multiply by 86400:         1039824000
>   (yes: this is "now - (now modulo 86400)"
> - Use this time for "--end":  "--end 1039824000"
>
> Now RRDtool tries to find a best match for
> "--end 1039824000 --start 1005264000 --width 400"
> and it will find an exact match for it in the available RRAs.
>
> You are asking for "--end now --start end-1y" (or similar) and
> RRDtool will search for "--end 1039868723".  The nearest available
> row in a CDP is at (now - (now modulo 300)) which is best matched
> by the "daily" RRA.
>
>
> --
> Much of what looks like rudeness in hacker circles is not intended to give
> offence. Rather, it's the product of the direct, cut-through-the-bullshit
> communications style that is natural to people who are more concerned about
> solving problems than making others feel warm and fuzzy.
>
> http://www.tuxedo.org/~esr/faqs/smart-questions.html
>
> --
> 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
>
>
>



--
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