Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Oct 2008 19:18:52 +0200
From:      Hartmut Brandt <hartmut.brandt@dlr.de>
To:        Eugene Grosbein <eugen@kuzbass.ru>
Cc:        net@freebsd.org
Subject:   Re: SNMP High Capacity Counters
Message-ID:  <48FA1A7C.5060801@dlr.de>
In-Reply-To: <20081018092405.GA91929@svzserv.kemerovo.su>
References:  <20081018092405.GA91929@svzserv.kemerovo.su>

next in thread | previous in thread | raw e-mail | index | archive | help
Eugene Grosbein wrote:
> Hi!
> 
> I've just found that ports/net-snmp (version 5.4) built
> WITH_MFD_REWRITES=yes supports IF-MIB, and in theory should show 64-bit
> ifHC* counters but it does not.
> 
> It seems agent/mibgroup/if-mib/data_access/interface_sysctl.c that obtains
> interface statistics from the kernel.
> The function netsnmp_arch_interface_container_load() has the following code:
> 
>         /* get counters */
>         entry->stats.ibytes.low = ifp->ifm_data.ifi_ibytes;
>         entry->stats.ibytes.high = 0;
>         entry->stats.iucast.low = ifp->ifm_data.ifi_ipackets;
>         entry->stats.iucast.high = 0;
>         entry->stats.imcast.low = ifp->ifm_data.ifi_imcasts;
>         entry->stats.imcast.high = 0;
> 
> So, it always produce 32-bit quantities. My question is:
> does FreeBSD/i386 kernel maintain 64-bit counters for interface statictics
> these days? If yes, since what version?

It does not, because not all architectures have atomic 64-bit increments 
and adds. Implementing 64-bit counters on these architectures would 
require some kind of locking. This was discussed in the past.

You might look at the IF-MIB implementation of bsnmp (it is in the base 
system). It uses periodic polling to detect wraps of the 32-bit 
counters. The poll interval is tuned to the fastest interface in the 
system (given that all interfaces reported the correct speed).

Note, that the netsnmp implementation is plain wrong - if the daemon 
does not support the HC counters it should never pretend to do. This is 
explicitely stated somewhere in the RFCs.

harti




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48FA1A7C.5060801>