LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-23-2010, 11:20 AM   #1
PoleStar
Member
 
Registered: Jul 2010
Posts: 165

Rep: Reputation: 2
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.

Last edited by PoleStar; 12-23-2010 at 11:29 AM.
 
Old 01-18-2011, 08:21 AM   #2
R Tape loading error
LQ Newbie
 
Registered: Aug 2005
Location: Worksop, UK
Distribution: Debian, there can be only one !
Posts: 3

Rep: Reputation: 0
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
 
Old 03-29-2011, 01:48 PM   #3
PoleStar
Member
 
Registered: Jul 2010
Posts: 165

Original Poster
Rep: Reputation: 2
Hello people,


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


Thanks.
 
Old 03-30-2011, 03:47 AM   #4
R Tape loading error
LQ Newbie
 
Registered: Aug 2005
Location: Worksop, UK
Distribution: Debian, there can be only one !
Posts: 3

Rep: Reputation: 0
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.
 
Old 03-31-2011, 11:18 AM   #5
PoleStar
Member
 
Registered: Jul 2010
Posts: 165

Original Poster
Rep: Reputation: 2
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
DBD::mysql::st execute failed: Column count doesn't match value count at row 1 shifter Programming 2 02-24-2010 08:42 PM
Download speed decreases when using Squid davidas Linux - Networking 0 04-15-2004 01:51 AM
bandwith decreases .....? Nadim Linux - Networking 1 11-15-2003 05:12 AM
hdparm decreases performance buddhahat Linux - Newbie 1 11-07-2003 11:10 PM
snmp (ucd-snmp, net-snmp) markus1982 Linux - Software 1 11-21-2002 11:45 AM


All times are GMT -5. The time now is 10:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration