# [mrtg] Re: How does it get those funky numbers?

PAUL WILLIAMSON pwilliamson at mandtbank.com
Mon Jul 22 16:01:03 MEST 2002

```Not quite.  It's more like doing it this way:

MRTG polls.
MRTG stores that number in the database.
MRTG polls again.  Subtracts last poll from current poll.
This is the first data point that shows on the graph.
That would be 1500 in your example.  1000 would never appear
as the starting number.

I may be wrong on the averages.  In looking over the code, I don't
think it is doing averages of averages.  I think it computes the averages as it polls them.  So, you are probably more correct for this statement explaining
it this way:

For the weekly averages, it takes the last 6 5 minute polls and averages them
for the 30 minute daily averages.  It also stores the max value for that 30 minute period.

For the monthly averages, it takes the last 24 5 minute polls and averages them
for the 2 hour monthly averages.  Same for max as above.  It stores it for a 2 hour period.

For the yearly averages, it takes the last 288 5 minute polls and averages them
for the 1 day yearly averages.  Same for max value.  It save the max for a 24 hour period.

Based on what the code looks like, I'm thinking this is more than likely what is happening,
NOT doing averages of averages.

Paul

>>> "Matt Katona" <mkatona at comwavz.com> 07/22/02 09:31AM >>>

Thanks Paul!!!

So in a nut shell:

MRTG reads the counter for an OID and records it (ie: 1000) and plots it on the graph
MRTG sleeps for five minutes then reads the counter again,  (ie: 2500). Now MRTG subtracts 1000 from 2500 and plots 1500 on the graph.
MRTG repeats step two every 5 minutes.

MRTG reads 6 polls in 30 minutes, adds all the entries up and divides by 6.
MRTG plots/records the 30 minute average.

MRTG takes the last 4 average 30 minutes polls in two hours, adds all the entries up and divides by 4.
MRTG plots/records the two hours average

MRTG takes the last 12 average 2 hour polls in 24 hours, adds all the entries up and divides by 12.
MRTG plots/records the Daily average

Anything else you think a suit might like to see?

-----Original Message-----
From: PAUL WILLIAMSON [mailto:pwilliamson at mandtbank.com]
Sent: Monday, July 22, 2002 9:07 AM
To: Matt Katona; mrtg at list.ee.ethz.ch
Subject: [mrtg] Re: How does it get those funky numbers?

First item is incorrect.  MRTG just pulls the number.  The first number plotted is
the DELTA of poll 1 and 2.  To get averages, it does it like this:

It gets 6 polls in 30 minutes, so it adds all the entries up and divides by 6.
Voila!  There's your 30 minute average.

How it does the monthly (2 hour) averages or the yearly (1 day) averages
is really averages of averages.  Since the 5 minute polls don't exist
for longer than 400 polling intervals, that's how it gets those averages.  In your example, 1500 would be the first entry in the database.

Don't forget normalization.  More than likely, you will not poll the device at exactly the same interval, so MRTG makes allowances for that.

Paul

>>> "Matt Katona" <mkatona at comwavz.com> 07/22/02 08:40AM >>>

Ok, management is asking about how MRTG pulls it's numbers. This is how I understand it (i'm looking for correction/clarification)

MRTG reads the counter for an OID and records it (ie: 1000) and plots it on the graph
MRTG sleeps for five minutes then reads the counter again,  (ie: 2500). Now MRTG subtracts 1000 from 2500 and plots 1500 on the graph.
MRTG repeats step two every 5 minutes.

But how does the "average" get calculated?

-+-+-+-+-+-+-+-+-+-+-+-
Matthew Katona
ComWavz
Systems Engineer
O:419-859-2194 x1771
C:419-460-1776
http://www.comwavz.com
"Consistency is the last refuge of the unimaginative" tagged by Oscar Wilde (1854-1900)

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

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

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