Compare this
# free -m total used free shared buffers cached Mem: 72363 68035 4328 0 522 66294 -/+ buffers/cache: 1218 71145 Swap: 12291 0 12291
and this:
# snmpwalk -c public -v 2c 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: 12586888 kB UCD-SNMP-MIB::memAvailSwap.0 = INTEGER: 12586784 kB UCD-SNMP-MIB::memTotalReal.0 = INTEGER: 74100516 kB UCD-SNMP-MIB::memAvailReal.0 = INTEGER: 4429580 kB UCD-SNMP-MIB::memTotalFree.0 = INTEGER: 17016364 kB UCD-SNMP-MIB::memMinimumSwap.0 = INTEGER: 16000 kB UCD-SNMP-MIB::memBuffer.0 = INTEGER: 534804 kB UCD-SNMP-MIB::memCached.0 = INTEGER: 44238560 kB UCD-SNMP-MIB::memSwapError.0 = INTEGER: noError(0) UCD-SNMP-MIB::memSwapErrorMsg.0 = STRING:
Why does free show 66294MB for "cache" while snmp shows about 44238MB for "memCached"? Shouldn't that be the same?
Looking at the MIB I see that the "memCached" is "physical or virtual" memory used for caching. (Don't tell me it puts disk cache into swap) ^^
The goal is finding out the real free physical memory (i.e. here 71145 as shown by free
) via snmp.
More info
# cat /proc/meminfo MemTotal: 74100516 kB MemFree: 4422092 kB Buffers: 542168 kB Cached: 44239460 kB SwapCached: 4 kB Active: 16455504 kB Inactive: 28707308 kB SwapTotal: 12586888 kB SwapFree: 12586784 kB Dirty: 2536 kB Writeback: 0 kB AnonPages: 381088 kB Mapped: 252132 kB Slab: 23961488 kB SReclaimable: 23648768 kB SUnreclaim: 312720 kB PageTables: 7812 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 49637144 kB Committed_AS: 4 kB VmallocTotal: 34359738367 kB VmallocUsed: 264124 kB VmallocChunk: 34359474191 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB DirectMap4k: 7936 kB DirectMap2M: 75481088 kB