[rrd-users] Re: Calculating traffic

Wupsje mrtg at wps.tmfweb.nl
Sun Mar 31 18:38:08 MEST 2002


I did this too and am satisfied with it.
However when I recreate my rrd files (eg start with an empty db) the
calculations don't exactly match.
What's it exactly doing then?

PS I have a hourly, weekly, monthly & yearly graph

Wupsje

-----Oorspronkelijk bericht-----
Van: rrd-users-bounce at list.ee.ethz.ch
[mailto:rrd-users-bounce at list.ee.ethz.ch]Namens Alex van den Bogaerdt
Verzonden: zondag 31 maart 2002 13:15
Aan: Matej Zerovnik - LeVaK
CC: RRD users
Onderwerp: [rrd-users] Re: Calculating traffic



Matej Zerovnik - LeVaK wrote:

> I`m logging bandwight(kB/s) on ppp0 in adsl.rrd file and now I want to
> calculate incoming and outgoing traffic(MB).How should I do that?

If you multiply <something per second> with the amount of
seconds, you end up with <something>

You have an average measured in kilobytes per second.  You probably
want to know the amount of traffic each month.  Display exactly a
month, take the average and multiply by the number of seconds this
month.  You can make the calculations a bit more easy if you always
take 30 days; this doesn't make a big difference.

So: 30 days times 24 hours per day times 60 minutes per hour times
60 seconds per minute is 2592000 seconds.
To get bytes from Bps you need to multiply by 2592000.  However, you
have kilobytes; to get bytes from kBps you need to multiply by 2592.
You want megabytes so you need to divide by 1,000,000 and end up with
a multiplier of 0.002592

Assuming ds0 is "in" and ds1 is "out":

    rrdtool graph whatever.png -a PNG --start end-2592000sec
    ...
    CDEF:Xin=ds0,0.002592,*
    CDEF:Xout=ds1,0.002592,*
    ...
    GPRINT:Xin:AVERAGE:"Total in:  %12.2lf MB\n"
    GPRINT:Xout:AVERAGE:"Total out: %12.2lf MB\n"
    ...

alternatively:
    ...
    CDEF:Xin=ds0,2592,*
    CDEF:Xout=ds1,2592,*
    ...
    GPRINT:Xin:AVERAGE:"Total in:  %6.2lf %sB\n"
    GPRINT:Xout:AVERAGE:"Total out: %6.2lf %sB\n"
    ...
to get gigabytes or kilobytes or whatever else is appropriate.

Of course you will have to fill in the missing parts yourself.

HTH
--
   __________________________________________________________________
 / alex at slot.hollandcasino.nl                  alex at ergens.op.het.net \
| work                                                         private |
| My employer is capable of speaking therefore I speak only for myself |
+----------------------------------------------------------------------+
| Technical questions sent directly to me will be nuked. Use the list. |
+----------------------------------------------------------------------+
| http://faq.mrtg.org/                                                 |
| http://rrdtool.eu.org  --> tutorial                                  |
+----------------------------------------------------------------------+

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