[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: snmpd on Sun Enterprise 250



Hello,

> On this machine i've apt-get installed snmpd from a woody source:
> 
> 05:38:54 danex:~# snmpget <hostname> <community> ifOutOctets.2
> interfaces.ifTable.ifEntry.ifOutOctets.2 = 4294967295

Try cat /proc/net/dev : you will see the counter is more high than this.

I was having the same problem. This is a bug in snmpd and values bigger
than 2^32-1. To resolve my problem, I have get and installed snmpd from
the sources : http://www.net-snmp.org/, and also applied a patch from a
net-snmp developer. (this was for version 4.2.3)

I have attached the original message of the developper of net-snmp
giving me the patch. Please note you need to edit a little the patch,
because the lines break are not correct.

Hope this help.

		Olivier
-- 
Olivier Bornet                 |      français : http://puck.ch/f
Swiss Ice Hockey Results       |      english  : http://puck.ch/e
http://puck.ch/                |      deutsch  : http://puck.ch/g
Olivier.Bornet@puck.ch         |      italiano : http://puck.ch/i
Get my PGP-key at http://puck.ch/pgp or at http://wwwkeys.pgp.net
--- Begin Message ---
On Wed, Dec 12, 2001 at 09:16:22AM +0100, Olivier Bornet wrote:
> Hello,
> 
> > > interfaces.ifTable.ifEntry.ifInOctets.2 = Counter32: 1611864348
> > > interfaces.ifTable.ifEntry.ifOutOctets.2 = Counter32: 4294967295
> > > 
> > > So, the In is OK, but the Out seem to limit to 2^32-1. As this is now since
> > > about a week...
> > 
> > Hmmm, I thought we had gotten these ruled out. What does /proc/net/dev
> > look like?
> 
> So, the /proc/net/dev contain (among other things) :
>   eth0:1613699263 9019257 ... 4540832067 7894842 ...
> 
> The values are good in /proc/net/dev
> 
> > What kernel version is this?
> 
> This is a 2.4.4 on SPARC.

Ahhh, I should have spotted that you answered your question yourself:
counters are unsigned 32-bit, and

$ bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
obase=16
4540832067
10EA79943

so this kernel keeps the counter in a 64-bit, which means that when we
read it with a %lu format it is returned as 0xFFFFFFFF. We have to read
it into an unsigned long long and then discard the excess ourselves
(until we get the ifXTable in place)

Maybe you could try this patch:

--- agent/mibgroup/mibII/interfaces.c   2001/11/28 22:30:33
1.75.2.16
+++ agent/mibgroup/mibII/interfaces.c   2001/12/12 18:29:37
@@ -1266,11 +1266,11 @@
     struct ifreq ifrq;
     struct ifnet **ifnetaddr_ptr;
     FILE *devin;
-    unsigned long rec_pkt, rec_oct, rec_err, snd_pkt, snd_oct, snd_err,
     coll;
+    unsigned long long rec_pkt, rec_oct, rec_err, snd_pkt, snd_oct,
snd_err, coll;
     int i, fd;
     conf_if_list *if_ptr;
-    const char *scan_line_2_2="%lu %lu %lu %*lu %*lu %*lu %*lu %*lu %lu
     %lu %lu %*lu %*lu %lu";
-    const char *scan_line_2_0="%lu %lu %*lu %*lu %*lu %lu %lu %*lu %*lu
     %lu";
+    const char *scan_line_2_2="%llu %llu %llu %*llu %*llu %*llu %*llu
%*llu %llu %llu %llu %*llu %*llu %llu";
+    const char *scan_line_2_0="%llu %llu %*llu %*llu %*llu %llu %llu
%*llu %*llu %llu";
     const char *scan_line_to_use;

 #endif


/Niels

-- 
Niels Baggesen - @home - Århus - Denmark - niels@baggesen.com
--          All people smile in the same language          --

_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


--- End Message ---

Reply to: