# Net-SNMP / 8.0-RELEASE - where did my Cached memory go?



## roscoe (Jan 23, 2010)

I use Cacti with FreeBSD 8.0 to monitor available memory among other things.  I am using the built-in Cacti templates for 

ucd/net - Memory - Buffers
ucd/net - Memory - Cache
ucd/net - Memory - Free

which polls the following SNMP MIBs:

UCD-SNMP-MIB::memShared.0 = INTEGER: 41928 kB
UCD-SNMP-MIB::memBuffer.0 = INTEGER: 113488 kB
*UCD-SNMP-MIB::memCached.0 = INTEGER: 0 kB*

Since upgrading to 8.0-RELEASE I've noticed the *memCached *always reads zero when polled.  I never had this issue under 7.2.

Is this is a bug?  "top" still shows a non-zero value for cached so I know it's not exhausted.

Thanks.


----------



## ohauer (Jan 31, 2010)

Do you have a value if you fire this command on your 8.x host
`$ snmpwalk -v2c -c $YourSNMPComunity localhost .1.3.6.1.4.1.2021.4
$ snmpwalk -v2c -c $YourSNMPComunity localhost .1.3.6.1.4.1.2021.4.15`

This is the OID *.1.3.6.1.4.1.2021.4.15* Cacti use to query your missing Value.
To cross check fire the command with parameter *-On* and compare the OID.


----------



## roscoe (Feb 2, 2010)

Hi ohauer,

I tried the commands and here is the resulting output:


```
# snmpwalk -v 2c -c 88VXR013 localhost .1.3.6.1.4.1.2021.4
UCD-SNMP-MIB::memIndex.0 = INTEGER: 0
UCD-SNMP-MIB::memErrorName.0 = STRING: swap
UCD-SNMP-MIB::memTotalSwap.0 = INTEGER: 1014576 kB
UCD-SNMP-MIB::memAvailSwap.0 = INTEGER: 1013812 kB
UCD-SNMP-MIB::memTotalReal.0 = INTEGER: 1035616 kB
UCD-SNMP-MIB::memAvailReal.0 = INTEGER: 224744 kB
UCD-SNMP-MIB::memTotalFree.0 = INTEGER: 398812 kB
UCD-SNMP-MIB::memMinimumSwap.0 = INTEGER: 16000 kB
UCD-SNMP-MIB::memShared.0 = INTEGER: 51156 kB
UCD-SNMP-MIB::memBuffer.0 = INTEGER: 113488 kB
[B]UCD-SNMP-MIB::memCached.0 = INTEGER: -12582912 kB[/B]
UCD-SNMP-MIB::memSwapError.0 = INTEGER: noError(0)
UCD-SNMP-MIB::memSwapErrorMsg.0 = STRING:
```

So that seems to be the offending value.  It's odd how the value is sometimes negative, other times it's zero.

I always had valid values under 7.2.  Restarting snmpd didn't seem to make a difference either.

I've decided to abandon SNMP and take the sysctl hardware counters route to plot the FreeBSD memory information for Cacti.

Thanks,
Roscoe


----------



## roscoe (Feb 2, 2010)

Just curious, is anyone else able to replicate this issue under 8.0?  How about under 7.2?

Try ohauer's command and see if you get a negative value for memCached.


```
$ snmpwalk -v2c -c $YourSNMPComunity localhost .1.3.6.1.4.1.2021.4
```

Thanks,
Roscoe


----------



## ohauer (Feb 2, 2010)

I've just tested 8.0 (amd64) in a VM with 512MB ram and my actual 7.2 (i386) machine.
net-snmp for the 8.0 machine was installed via pkg_add -r (version is net-snmp-5.4.2.1_6).

Maybe it is an overflow, can you file a PR?

7.2-RELEASE-p6 (i386, net-snmp-5.4.2.1_6) 

```
# snmpwalk -v2c -c $COMMUNITY localhost .1.3.6.1.4.1.2021.4
UCD-SNMP-MIB::memIndex.0 = INTEGER: 0
UCD-SNMP-MIB::memErrorName.0 = STRING: swap
UCD-SNMP-MIB::memTotalSwap.0 = INTEGER: 4194176 kB
UCD-SNMP-MIB::memAvailSwap.0 = INTEGER: 4194176 kB
UCD-SNMP-MIB::memTotalReal.0 = INTEGER: 2611604 kB
UCD-SNMP-MIB::memAvailReal.0 = INTEGER: 119416 kB
UCD-SNMP-MIB::memTotalFree.0 = INTEGER: 637840 kB
UCD-SNMP-MIB::memMinimumSwap.0 = INTEGER: 16000 kB
UCD-SNMP-MIB::memShared.0 = INTEGER: 49044 kB
UCD-SNMP-MIB::memBuffer.0 = INTEGER: 114880 kB
UCD-SNMP-MIB::memCached.0 = INTEGER: 42808 kB
UCD-SNMP-MIB::memSwapError.0 = INTEGER: noError(0)
UCD-SNMP-MIB::memSwapErrorMsg.0 = STRING:
```

8.0-RELEASE-p2 (amd64, net-snmp-5.4.2.1_6 after a 'find /')

```
# snmpwalk -v2c -c $COMMUNITY 10.6.16.251 .1.3.6.1.4.1.2021.4
UCD-SNMP-MIB::memIndex.0 = INTEGER: 0
UCD-SNMP-MIB::memErrorName.0 = STRING: swap
UCD-SNMP-MIB::memTotalSwap.0 = INTEGER: 1008544 kB
UCD-SNMP-MIB::memAvailSwap.0 = INTEGER: 1008544 kB
UCD-SNMP-MIB::memTotalReal.0 = INTEGER: 510220 kB
UCD-SNMP-MIB::memAvailReal.0 = INTEGER: 444096 kB
UCD-SNMP-MIB::memTotalFree.0 = INTEGER: 208024 kB
UCD-SNMP-MIB::memMinimumSwap.0 = INTEGER: 16000 kB
UCD-SNMP-MIB::memShared.0 = INTEGER: 5524 kB
UCD-SNMP-MIB::memBuffer.0 = INTEGER: 31440 kB
UCD-SNMP-MIB::memCached.0 = INTEGER: 925822976 kB
UCD-SNMP-MIB::memSwapError.0 = INTEGER: noError(0)
UCD-SNMP-MIB::memSwapErrorMsg.0 = STRING:
```


----------



## chrcol (Feb 22, 2010)

tried enabling 64bit counters?


----------

