snmp acting illogically. in/out( ifInOctets/ifOutOctets) count decreases.
Hi,
I am trying to calculate band Width on few interfaces. Every thing works fine, bandWidth goes up when user loged in it goes down the moment working hrs are over. Only problem is once in a while it show negative bandWidth ? I make that script to send information in-case it negative. here are few examples Code:
from IP XX.X.X.X interface X Code:
Any one know what is going on? I took formula to calculate bandwidth from cisco website http://www.cisco.com/en/US/tech/tk64...8009496e.shtml Code:
|
This sounds to me like you are not taking into account the data size of the attributes you are reading.
Usually these are 32-bit counters so your limit would be 0 - 4294967295 http://www.cisco.com/en/US/tech/tk64...800b69ac.shtml |
Hello people,
Those routers/switches reset counters(to zero) after a certain number. That was causing the problem. Thanks. |
All counters will 'flip-over' to zero once the data type size limit is reached, the difference is the maximum value that can be stored in either the 32-bit counters or the 64-bit counters. the reason for getting negative numbers is from using signed rather than un-signed data types.
Maximum value for a 32 bit unsigned integer is 4,294,967,295. For a 64 bit unsigned integer it's 18,446,744,073,709,551,615. For signed, it's basically half. You will always have the problem of overflowing and going back to zero, it will just last longer with the 64-bit counters. |
Thanks.
for now I took care of it in the code. When it detects a negative value, it remove every variable , store reading again, wait for 3 sec and take next reading. That way some time I see little spike, because it calculates bandwidth for 3 sec, instead of original plane which is 5 min. But results are very acceptable. |
All times are GMT -5. The time now is 07:36 PM. |