Subject: net-snmp gets some 'host' MIB results wrong on NetBSD
To: NetBSD Packages Technical Discussion List <tech-pkg@NetBSD.ORG>
From: Greg A. Woods <woods@weird.com>
List: tech-pkg
Date: 01/19/2003 17:48:18
Net-snmp-5.0.6 (and 5.07) seems to get some of its 'host' MIB results
wrong on NetBSD.

Here's a trimmed down example table from my development server:

SNMP table: HOST-RESOURCES-MIB::hrStorageTable

     hrStorageDescr hrStorageAllocationUnits hrStorageSize hrStorageUsed
                  /               1024 Bytes        490591        277259
               /var               1024 Bytes        490591        217161
              /home               2048 Bytes      10939735       5558641
               /tmp               1024 Bytes        247703           161
              /kern                512 Bytes             2             2
              /proc               4096 Bytes             1             1
             /fdesc                512 Bytes             2             2
        Real Memory               4096 Bytes         76855         41212
         Swap Space               4096 Bytes        151259        115616
     Memory Buffers                256 Bytes          1024        368128


First off note the swap space values don't seem to add up.

# swapctl -lk 
Device      1K-blocks     Used    Avail Capacity  Priority
/dev/sd3b      522500    73904   448596    14%    0
/dev/sd0b      506768    74000   432768    15%    0
/dev/sd1b      506768    74600   432168    15%    0
/dev/sd2b      506800    75112   431688    15%    0
Total         2042837   297616  1745221    15%

The total swap storage size is wrong (not even close):

	# expr 2042837 / 4
	510709			!= 151259

As is the total swap storage used:

	# expr 297616 / 4
	74404			!= 115616


Also the "memory buffers" size and used columns seem to be reversed,
though they don't really make much sense at all when compared to the
system's current configuration and status:

# sysctl kern.mbuf
kern.mbuf.msize = 256
kern.mbuf.mclbytes = 2048
kern.mbuf.nmbclusters = 8192
kern.mbuf.mblowat = 16
kern.mbuf.mcllowat = 8
# netstat -m
239 mbufs in use:
        150 mbufs allocated to data
        85 mbufs allocated to packet headers
        4 mbufs allocated to socket names and addresses
150/198 mapped pages in use
496 Kbytes allocated to network (72% in use)
0 requests for memory denied
0 requests for memory delayed
0 calls to protocol drain routines


I don't really have time to delve into this on my own.  Does anyone have
any clues about this, or should I just report it to the net-snmp folks?

Note also that walking the 'host' MIB also causes a stream of a few of
these errors on stderr too:

	snmpd in free(): warning: junk pointer, too high to make sense.

-- 
								Greg A. Woods

+1 416 218-0098;            <g.a.woods@ieee.org>;           <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>