[mrtg] Re: Calling mrtg at different time

Alex van den Bogaerdt alex at slot.hollandcasino.nl
Fri Sep 17 15:40:17 MEST 1999


> Maybe it is a simple question, but what will be the difference in the graphs if I set the cron job to monitor the SNMP device at different time intervals, say 2 mins and 5 mins?
> 
> Thanks.
> Ken
> 
> ---------------------------------------------------------
> You monitor every five minutes, this is 300 seconds.
> A rate of 107 Mb/s is 107 * 1000 * 1000 / 8 MB/s is 13375000 B/s.
> 300 seconds @ 107Mb/s is 4012500000 B/s.
>                  2^32 is 4294967296 ... oops, darn close.
> The equivalent rate for 2^32 is 114.53 Mb/s.
> Most likely you are having problems with this.
> 
[snip]

> There are a few options:
> 
> 1) Monitor more often (just call the mrtg script every two minutes) so that
>    the counter won't increase with values over 2^32.
> 2) Switch to rrdtool
> 

The traffic rate is first low, then it increases to around 4,000,000,000 .
2^32 = 4,294,967,296 and this is the highest number the system can handle.
If you add 4,000,000,000 and 4,000,000,000 (would be 8,000,000,000) then
the resulting value would be (8,000,000,000 modulo 2^32 ==) 3,705,032,704

Think of the counter in your car. If it has 6 digits, the largest number
that it can handle would be "999999" and if you drive another 50 KM the
counter will read "000049". This is aperantly a negative delta of 999950.

MRTG does not handle this situation very well, it discards any negative
delta and uses the previous delta.

Time       increase   resulting counter
 000    500,000,000                              500,000,000
 300    500,000,000                            1,000,000,000
 600  4,000,000,000   5,000,000,000 mod 2^32 =   705,032,704
 900  4,000,000,000   4,705,032,704 mod 2^32 =   410,065,408
1200  4,000,000,000   4,410,065,408 mod 2^32 =   115,098,112
1500  4,000,000,000                            4,115,096,112

I expect the following to happen:

MRTG gets the counters as they are in the last column. It sees
the following increases:

Time
 000   unknown in this example, not important.
 300   1,000,000,000 -   500,000,000 = 500,000,000   correct
 600   negative -> invalid -> use      500,000,000   incorrect
 900   negative -> invalid -> use      500,000,000   incorrect
1200   negative -> invalid -> use      500,000,000   incorrect
1500   4,115,096,112 - 4,000,000,000 = 115,096,112   incorrect

As you can see, the line flattens at a wrong rate and then jumps
to another wrong rate...

If you would monitor every 1.25 minutes (just to make the math
easy for my convenience!), the huge increments are reduced to
about 1,000,000,000 and the counter wrap doesn't occur as often
as it would do in above example. Therefore you won't see wrong
increases in MRTG. Beware: it is only a workaround and the real
solution is using rrdtool.

Regards,
Alex

--
* To unsubscribe from the mrtg mailing list, send a message with the
  subject: unsubscribe to mrtg-request at list.ee.ethz.ch
* The mailing list archive is at http://www.ee.ethz.ch/~slist/mrtg


More information about the mrtg mailing list