LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   snmp acting illogically. in/out( ifInOctets/ifOutOctets) count decreases. (https://www.linuxquestions.org/questions/linux-newbie-8/snmp-acting-illogically-in-out-ifinoctets-ifoutoctets-count-decreases-852037/)

PoleStar 12-23-2010 10:20 AM

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

  inCounters new =  1056124169  old =  484753332
 outCounters new =  71539457 old =  4205963496
 inDelta = 571370837
outDelta = -4134424039
inBandw = 7.61827782666667
 outBandw = -55.1256538533333
  time delta = 600


Code:


 from IP XX.X.X.XX interface XX

  inCounters new =  312030197  old =  2835394885
 outCounters new =  372140664 old =  222527326
 inDelta = -2523364688
 outDelta = 149613338
inBandw = -33.6448625066667
 outBandw = 1.99484450666667
  time delta = 600

That decreased count cause bandwidth to go negative too.
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:


inPut utilization = (change x 8 X 100) / (change in time X connection speed)

but that would not matter because , problem is caused by lowering count on in and out packets.

R Tape loading error 01-18-2011 07:21 AM

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

PoleStar 03-29-2011 12:48 PM

Hello people,


Those routers/switches reset counters(to zero) after a certain number.
That was causing the problem.


Thanks.

R Tape loading error 03-30-2011 02:47 AM

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.

PoleStar 03-31-2011 10:18 AM

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.