--- Begin Message ---
- To: Olivier Bornet <Olivier.Bornet@puck.ch>, net-snmp-coders@lists.sourceforge.net
- Subject: Re: Problem with counter overflow
- From: Niels Baggesen <nba@users.sourceforge.net>
- Date: Wed, 12 Dec 2001 19:30:50 +0100
- Message-id: <20011212183050.GA15031@sbmail.statsbiblioteket.dk>
- In-reply-to: <20011212091622.A29486@smartdata.ch>
- References: <20011211231933.B1460@puck.ch> <20011211224434.GC12477@sbmail.statsbiblioteket.dk> <20011212091622.A29486@smartdata.ch>
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 ---