# [rrd-users] Re: Total num bytes graph solved (i think)

Alex van den Bogaerdt alex at ergens.op.het.net
Sun Jun 22 12:47:57 MEST 2003

```On Sat, Jun 21, 2003 at 05:10:08PM +0200, Mats Pettersson wrote:

> I know someone called Chris here who posted the subject *shrugs* had a
> similar problem. I don't quite know how accurate my graph is (i'm not
> confident with my mathematical skills :), but i think it match my traffic
> ok. I actually did as Chris suggested using PREV in a CDEF, but i discovered
> that since the first PREV is unknown the rest of the calculation fails, so i
> just added a test and replaced PREV with 0 if PREV was unknown, as follows:

Sigh.  How many times do I need to post this?

The total amount of traffic equals the average amount of traffic
multiplied by the total amount of time.

Bps can also be written as (B/s).  (B/s)*s = B.

If you display exactly one day in your graph, just multiply the
average by 24*60*60.

If you display exactly a week in your graph, just multiply the
average by 24*60*60*7.

and so on.

> #Daily graph
> rrdtool graph daily_total.png -s -24h \
> DEF:bbin=/path/traffic.rrd:bin:AVERAGE \
> DEF:bbout=/path/traffic.rrd:bout:AVERAGE \

fine

Then:

CDEF:totalin=bbin,86400,*
CDEF:totalout=bbout,86400,*
CDEF:total=totalin,totalout,+

Now GPRINT totalin, totalout and/or total.

Example math:

5-minute interval rates are: 100,200,300,200,300,100 (Bps)
Average in that half hour is: (100+200+300+200+300+100)/6 = 200 (Bps)

Total amount:
300 seconds at 100 Bps = 30000 B
300 seconds at 200 Bps = 60000 B
300 seconds at 300 Bps = 90000 B
300 seconds at 200 Bps = 60000 B
300 seconds at 300 Bps = 90000 B
300 seconds at 100 Bps = 30000 B
------------------------------ +
360000 B

The average of 200 Bps multiplied by 1800 s = 360000.

This is the same amount.

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