# [mrtg] Re: Formula for calculating Network Utilisation

Meng Keng Lee mengkenglee at yahoo.com
Thu Jul 1 12:05:10 MEST 2004

```Hello Alex,

Thanks for giving a detailed explanation.

Is it possible in MRTG to do the following?
=> 70% to 90% Utilisation => Send email alert to Engineer
=> > 90% Utilisation => Send email alert to Manager

Alex van den Bogaerdt <alex at ergens.op.het.net> wrote:
On Thu, Jun 24, 2004 at 11:20:41PM -0700, Meng Keng Lee wrote:

> Perhaps I could explain better if I show you my MRTG conf:

That is bytes. It is also equal to 100000000 bits.

> >From the config above, I notice that the MaxBytes is 12500000 but using Getif ifSpeed is 100000000

Bytes vs. Bits.

> Just read from some Cisco docs last night, it says that the correct way
> of measure bandwidth is (ifInOctets X 8 X100) / (Number of seconds X ifSpeed).

And they are right, as long as you start counting from the moment the device
is switched on. That is ___not___ 300 seconds.

Look at the formula again and recall your math lessons:

"ifInOctets" is in (bytes)
"ifSpeed" is in (bits/time).
"Number of seconds" is in (time)

"Number of seconds * ifSpeed" is in (time * (bits/time))
is in (bits * time/time)
is in (bits * 1)
is in (bits)

"ifInOctets * 8" is in (bits)

The maximum possible amount of data during a certain interval is
the maximum possible transfer rate, multiplied by the amount of time.

The real amount of data during a certain interval is in ifInOctets.

The following formulas are all the same:

real amount
percentage = 100 * ----------------
maximum possible

100 * real amount
percentage = -----------------
maximum possible

real amount
percentage = ----------------------
maximum possible / 100

real amount
percentage = -----------------------
maximum possible * 0.01

In stead of taking the whole amount of time since boot and the whole
amount of traffic since boot, you can also use the current amount minus
the previous amount. This will calculate the percentage over a limited
amount of time; this is what MRTG does.

The amount of data is (current_ifInOctets - previous_ifInOctets).
The amount of time is (current_time - previous_time)

MRTG calculates this itself, you do not need do do this. The formula
is the same.

Alex
--
you reply to me off-list, you'd better tell me you're doing so. If
you don't, and if I reply to the list, that's your problem, not mine.

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive http://www.ee.ethz.ch/~slist/mrtg
FAQ http://faq.mrtg.org Homepage http://www.mrtg.org

---------------------------------
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org