# [mrtg] Re: Formula for calculating Network Utilisation

William Owen William.Owen at ProfilesInternational.com
Fri Jul 2 16:24:43 MEST 2004

```The program passes the allows you to monitor the threshold on the relative
percentage value, but it passes the raw value to you ThresholdMax program.
If you are looking for the relative value on your Threshold program, you can
always calculate them using your MaxBytes value and then running the <90
logic against the results.  Alternatively, you could calculate this number
and compare.

MaxBytes: 125000

90% = 12491

EX1:
if (\$utalization < 12491 ) {
\$email = 'email1 at company.com';
}
else {
\$email = 'email2 at company.com';
}

EX2:
\$Percent = (\$utalization \ 125000) * 10;

if (\$Percent < 90 ) {
\$email = 'email1 at company.com';
}
else {
\$email = 'email2 at company.com';
}

-----Original Message-----
From: Meng Keng Lee [mailto:mengkenglee at yahoo.com]
Sent: Friday, July 02, 2004 4:17 AM
To: mrtg at list.ee.ethz.ch
Subject: [mrtg] Re: Formula for calculating Network Utilisation

Hello William,

I noticed that ThresholdMaxI passes 3 arguments: the \$router variable, the
threshold value broken( in the case will be 70%), the current parameter
value.  I noticed that the current parameter value is often more than 100.
In fact I noticed that the value is 26052.2781666667 or 5179.73132222222,
etc. Both value are definitely not below 100%.
How do I compute the current parameter value to be in percentage?

Regards

William Owen <William.Owen at ProfilesInternational.com> wrote:
When the threshold is breached, MRTG will pass information to whatever your
external script is. You could write in some intelligence where:

if (\$utalization < 90 ) {
\$email = 'email1 at company.com'
}
else {
\$email = 'email2 at company.com'
}

-----Original Message-----
From: Meng Keng Lee [mailto:mengkenglee at yahoo.com]
Sent: Thursday, July 01, 2004 5:05 AM
To: Alex van den Bogaerdt; mrtg at list.ee.ethz.ch
Subject: [mrtg] Re: Formula for calculating Network Utilisation

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

---------------------------------
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.

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