[rrd-users] Re: Dealing with counter resets

Alex van den Bogaerdt alex at slot.hollandcasino.nl
Sun Dec 2 01:20:33 MET 2001


Sune Stjerneby wrote:

> > There is (in cisco equipment at least)
> > an snmp variable that indicates how long it has been since the
> > counters were cleared.  Read it an check if the time  was since your last reading.
> > If so, ignore one round of in&out counters.  This also takes care of power failures 
> > and other glitches that may have caused the device to reset the counters.
> 
> Thanks - I modified this idea bit, so what I ended up doing was
> comparing the current value of *Octets with the previous value,
> and if the previous value is less than the current, skip the
> insert (the script exits).

I assume you ment to write it down the other way: if the current
value is less than the previous value ...

Even then: this will seriously impact your monitoring when the counter
wraps often.  For a 64-bit counter this will probably never happen but
for a 32-bit counter this can happen quite often.  Each time it happens
you skip the insert.

Apart from the lost quality there is another effect (depending on your
heartbeat setting).  What if:

-1- the counter value is high, somewhere in the 2^30 range
-2- the next value is low, just above zero
-3- the next value is high again, higher than the one at (1)

You will skip the insert at (2) and rrdtool will see:
-1- the counter value is high, somewhere in the 2^30 range
-3- the next value is high again, higher than the one at (1)

This means that the increment over 10 minutes was small.  When
divided by 600 it is even smaller.  RRDtool will store a very
low rate while in reality the rate was high (3 mbps or so).

The proper way to separate real counter wraps from counter resets
is to check for reboot and/or clearing of the counters.  The next
best thing is to insert an unknown value:

-1- the counter value is high, somewhere in the 2^29 range
    insert it as usual
-2- the next value is low, just above zero
    one second before this time, insert U. Then insert this value
-3- the next value is high again, higher than the one at (1)
    insert it as usual

Now RRDtool will see:
-1a- the counter value is high, somewhere in the 2^29 range
-1b- you suspect a reset so you insert U
-2-  the next value is low, just above zero
-3-  the next value is high again, higher than the one at (1a)

Now RRDtool will compute the first interval of 300 seconds to be
unknown (between (1) and (2)) and the next interval to be at a
high rate (the difference between (3) and (2) divided by 300).

For advanced front ends it may be possible to calculate when
the reset of the device occured (uptime) and insert the following:

-1a- the counter value is high, somewhere in the 2^29 range
     insert it as usual
-1b- one second before (1c): insert an unknown
-1c- the reset occured here, insert zero
-2-  this is the real measured value apx. 300 seconds after (1)
     insert it as usual
-3-  the next value is high again, higher than the one at (1)
     insert it as usual

Now RRDtool knows a lot about interval (1) to (2).  I don't
know for sure but it wouldn't surprise me if it would even come
up with a good aproximation of the rate during that interval.
It will again know about the interval from (2) to (3).

HTH
-- 
   __________________________________________________________________
 / 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