Re: Odd values for various memory metrics via SNMP
- In reply to: Yuri : "Re: Odd values for various memory metrics via SNMP"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 19 Dec 2023 17:37:48 UTC
Yuri wrote: > Patrick M. Hausen wrote: >> HI Yuri, >> >>> Am 19.12.2023 um 09:50 schrieb Yuri <yuri@aetern.org>: >>> Let's start with OIDs, which ones exactly you are looking at (numeric or >>> textual will do)? >> >> To start I'll post the 4 odd ones of my OPNsense system, FreeBSD 13.2-p7, net-snmp 5.9.1_4,1: > > OK, guess the following (physical memory) looks correct for you as well? > > --- > HOST-RESOURCES-MIB::hrStorageIndex.1 = INTEGER: 1 > HOST-RESOURCES-MIB::hrStorageType.1 = OID: > HOST-RESOURCES-TYPES::hrStorageRam > HOST-RESOURCES-MIB::hrStorageDescr.1 = STRING: Physical memory > HOST-RESOURCES-MIB::hrStorageAllocationUnits.1 = INTEGER: 4096 Bytes > HOST-RESOURCES-MIB::hrStorageSize.1 = INTEGER: 4183816 > HOST-RESOURCES-MIB::hrStorageUsed.1 = INTEGER: 1499092 > HOST-RESOURCES-MIB::hrStorageAllocationFailures.1 = Counter32: 0 > --- > >> HOST-RESOURCES-MIB::hrStorageIndex.2 = INTEGER: 2 >> HOST-RESOURCES-MIB::hrStorageType.2 = OID: HOST-RESOURCES-TYPES::hrStorageRam >> HOST-RESOURCES-MIB::hrStorageDescr.2 = STRING: Real memory >> HOST-RESOURCES-MIB::hrStorageAllocationUnits.2 = INTEGER: 4096 Bytes >> HOST-RESOURCES-MIB::hrStorageSize.2 = INTEGER: 191414 >> HOST-RESOURCES-MIB::hrStorageUsed.2 = INTEGER: 189988 >> HOST-RESOURCES-MIB::hrStorageAllocationFailures.2 = Counter32: 0 >> --- >> HOST-RESOURCES-MIB::hrStorageIndex.9 = INTEGER: 9 >> HOST-RESOURCES-MIB::hrStorageType.9 = OID: HOST-RESOURCES-TYPES::hrStorageOther >> HOST-RESOURCES-MIB::hrStorageDescr.9 = STRING: Shared real memory >> HOST-RESOURCES-MIB::hrStorageAllocationUnits.9 = INTEGER: 4096 Bytes >> HOST-RESOURCES-MIB::hrStorageSize.9 = INTEGER: 25627 >> HOST-RESOURCES-MIB::hrStorageUsed.9 = INTEGER: 24175 >> HOST-RESOURCES-MIB::hrStorageAllocationFailures.9 = Counter32: 0 >> --- >> HOST-RESOURCES-MIB::hrStorageIndex.8 = INTEGER: 8 >> HOST-RESOURCES-MIB::hrStorageType.8 = OID: HOST-RESOURCES-TYPES::hrStorageOther >> HOST-RESOURCES-MIB::hrStorageDescr.8 = STRING: Shared virtual memory >> HOST-RESOURCES-MIB::hrStorageAllocationUnits.8 = INTEGER: 4096 Bytes >> HOST-RESOURCES-MIB::hrStorageSize.8 = INTEGER: 54962 >> HOST-RESOURCES-MIB::hrStorageUsed.8 = INTEGER: 41268 >> HOST-RESOURCES-MIB::hrStorageAllocationFailures.8 = Counter32: 0 >> --- >> HOST-RESOURCES-MIB::hrStorageIndex.3 = INTEGER: 3 >> HOST-RESOURCES-MIB::hrStorageType.3 = OID: HOST-RESOURCES-TYPES::hrStorageVirtualMemory >> HOST-RESOURCES-MIB::hrStorageDescr.3 = STRING: Virtual memory >> HOST-RESOURCES-MIB::hrStorageAllocationUnits.3 = INTEGER: 4096 Bytes >> HOST-RESOURCES-MIB::hrStorageSize.3 = INTEGER: 1279129 >> HOST-RESOURCES-MIB::hrStorageUsed.3 = INTEGER: 1258824 >> HOST-RESOURCES-MIB::hrStorageAllocationFailures.3 = Counter32: 0 > > I took a look at FreeBSD-specific interface for getting memory values > (agent/mibgroup/hardware/memory/memory_freebsd.c) and all it does is > parsing the following sysctl (vm.vmtotal) output: > > --- > vm.vmtotal: > System wide totals computed every five seconds: (values in kilobytes) > =============================================== > Processes: (RUNQ: 2 Disk Wait: 0 Page Wait: 0 Sleep: 30) > Virtual Memory: (Total: 538434716K Active: 538414860K) > Real Memory: (Total: 78488K Active: 75752K) > Shared Virtual Memory: (Total: 52052K Active: 32236K) > Shared Real Memory: (Total: 27284K Active: 24588K) > Free Memory: 9474964K > --- > > So I guess what net-snmp reports makes sense and the only value that > should be used for alerts is that "physical memory" one. OTOH, using the other way to get these values (the code checks for VM_TOTAL define) seems to provide somewhat saner values, try editing agent/mibgroup/hardware/memory/memory_freebsd.c after doing `make patch` and add the #undef as below (not providing diff output as it won't make much sense here): --- #if HAVE_SYS_VMPARAM_H #include <sys/vmparam.h> #else #include <vm/vm_param.h> #endif #undef VM_TOTAL ---