[rrd-users] Re: Total Throughput Stats via RRD

Dave Plonka plonka at doit.wisc.edu
Thu Apr 6 15:22:49 MEST 2000

On Thu, Apr 06, 2000 at 05:43:12PM +0800, Jason Jordan wrote:
> I'm using MRTG with 14all.cgi (and therefore RRD) to monitor a bunch of
> routers, switches, hubs and servers.
> Manglement have just asked me if I can provide them with total
> throughput stats for particular traffic-billable WAN connections (ie.
> the Internet).
> They want these statistics retrospectively - and I told them it's
> impossible for me to analyse things I haven't logged.
> However, it occurred to me that RRD is effectively recording total data
> throughput for each interface/device.

Well sort of... most front-ends are averaging the data over periods of
time as defined in the RRAs (the round-robin-archives withing the RRD
files).  As time passes those periods of time get bigger (5 mins -> 30
mins -> 2 hours -> 24 hours, etc.) therefore they are less likely to
line up "perfectly" with the arbitrary time range you specify.
Probably good enough for government work though.

> What I need to do is calculate a total for each calendar month (or some
> abitrary period of time).  
> Anyone done this?  Anyone know how?  Is this a dumb question?

Since your RRD DSes are likely to be of type ABSOLUTE in an RRA of type
AVERAGE, they've already been converted into some rate such as
bytes/second.  So, to get the totals you want, you'll need to find the
average of the averages and multiply it out.  One way is to build a
graph that uses GPRINT's AVERAGE consolidation function to print the
average of the AVERAGEs stored in your RRD files of the DSes in
question, and multiply it out you can get this.

Without writing any code (to invoke rrdtool graph yourself), one way to
figure this out would be to use RRGrapher and select its "Show
statistics using this format: [%.0lf]" check-box before generating the


That is, RRGrapher will give you a figure in the graph legend saying
that the DS has an "ave" of `x' (e.g. "bytes per second") for the given
time range.  Caculate the number of seconds in the time range and then
multiply to get the total for that time range.  RRGrapher also lets you
arbitrarily specify the start and end date/time.

To get the number of seconds in your time range, I would convert each
date to a time_t (seconds since the epoch) and subtracting one from the
other, but you can use the less magical, and less precise, way of
multiplying by 86400 seconds per day if you want.


plonka at doit.wisc.edu  http://net.doit.wisc.edu/~plonka  ARS:N9HZF  Madison, WI

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

More information about the rrd-users mailing list