[rrd-users] Re: Calculating traffic

Alex van den Bogaerdt alex at slot.hollandcasino.nl
Sun Mar 31 13:14:49 MEST 2002

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 
    GPRINT:Xin:AVERAGE:"Total in:  %12.2lf MB\n"
    GPRINT:Xout:AVERAGE:"Total out: %12.2lf MB\n"

    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.

 / 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

More information about the rrd-users mailing list