Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
currently net-snmp overestimates RHEL7 memory usage which result lot of wrong memory alert
Description
net-snmp overestimates the memory usage than that of free output
Reason : free command includes slab allocation in cache, which is not included by HOST-RESOURCES-MIB i.e. net-snmp.
# snmpwalk -Os -v2c -cpublic localhost hrStorage | grep '\.[167] ='
hrStorageIndex.1 = INTEGER: 1
hrStorageIndex.6 = INTEGER: 6
hrStorageIndex.7 = INTEGER: 7
hrStorageType.1 = OID: hrStorageRam
hrStorageType.6 = OID: hrStorageOther
hrStorageType.7 = OID: hrStorageOther
hrStorageDescr.1 = STRING: Physical memory
hrStorageDescr.6 = STRING: Memory buffers
hrStorageDescr.7 = STRING: Cached memory
hrStorageAllocationUnits.1 = INTEGER: 1024 Bytes
hrStorageAllocationUnits.6 = INTEGER: 1024 Bytes
hrStorageAllocationUnits.7 = INTEGER: 1024 Bytes
hrStorageSize.1 = INTEGER: 19799404
hrStorageSize.6 = INTEGER: 19799404
hrStorageSize.7 = INTEGER: 2428420
hrStorageUsed.1 = INTEGER: 6758148
hrStorageUsed.6 = INTEGER: 279280
hrStorageUsed.7 = INTEGER: 2428420
hrStorageUsed includes buffers and cache, so you can get an estimate of total free RAM like this:
totFree = total - used + buffers + cache
As per above outputs
totFree = hrStorageSize.1 - hrStorageUsed.1 + hrStorageUsed.6 + hrStorageUsed.7
= 19799404 - 6792488 + 280040 + 2447248
= 15734204 KB
As per free output total free memory would be as follows :
# free
total used free shared buff/cache available
Mem: 19799404 3709992 13008312 846124 3081100 14787728
Swap: 10027004 0 10027004
totFree = free + buff/cache
= 13008312 + 3081100
= 16089412 KB
Here is the discrepancy in memory usage between net-snmp and free. Though both free and HOST-RESOURCES-MIB get their data from /proc/meminfo, but use slightly different metrics. From man free:
buffers : Memory used by kernel buffers (Buffers in /proc/meminfo)
cache : Memory used by the page cache and slabs (Cached and Slab in /proc/meminfo)
So free includes slab allocation in cache, while HOST-RESOURCES-MIB doesn't. If we get the slab allocation:
# grep Slab /proc/meminfo
Slab: 353696 kB
and add it to what we got from SNMP, we have:
totFree = 15734204 + 353696
= 16087900 KB
Is it possible to include slab allocation in net-snmp memroy usage ?
Version-Release number of selected component (if applicable):
net-snmp-5.7.2-24.el7_3.2.x86_64
How reproducible:
1. Install net-snmp
2. Start the service
3. Collect memory usage using net-snmp
Steps to Reproduce:
1. Check memory usage using net-snmp
2. Check memory usage using free command
3. Compare the memory usage
Actual results:
net-snmp over estimates memory usage on the system
Expected results:
net-snmp and free should show similar memory usage
Additional info:
slab allocation is not considered by net-snmp memory usage
Note that Slab breaks down to Slab Reclaimable and Slab Unreclaimable; only Slab Reclaimable should be considered as part of free memory, I believe.
from /proc/meminfo:
...
Slab: 753336 kB
SReclaimable: 640876 kB
SUnreclaim: 112460 kB
...
Description of problem: currently net-snmp overestimates RHEL7 memory usage which result lot of wrong memory alert Description net-snmp overestimates the memory usage than that of free output Reason : free command includes slab allocation in cache, which is not included by HOST-RESOURCES-MIB i.e. net-snmp. # snmpwalk -Os -v2c -cpublic localhost hrStorage | grep '\.[167] =' hrStorageIndex.1 = INTEGER: 1 hrStorageIndex.6 = INTEGER: 6 hrStorageIndex.7 = INTEGER: 7 hrStorageType.1 = OID: hrStorageRam hrStorageType.6 = OID: hrStorageOther hrStorageType.7 = OID: hrStorageOther hrStorageDescr.1 = STRING: Physical memory hrStorageDescr.6 = STRING: Memory buffers hrStorageDescr.7 = STRING: Cached memory hrStorageAllocationUnits.1 = INTEGER: 1024 Bytes hrStorageAllocationUnits.6 = INTEGER: 1024 Bytes hrStorageAllocationUnits.7 = INTEGER: 1024 Bytes hrStorageSize.1 = INTEGER: 19799404 hrStorageSize.6 = INTEGER: 19799404 hrStorageSize.7 = INTEGER: 2428420 hrStorageUsed.1 = INTEGER: 6758148 hrStorageUsed.6 = INTEGER: 279280 hrStorageUsed.7 = INTEGER: 2428420 hrStorageUsed includes buffers and cache, so you can get an estimate of total free RAM like this: totFree = total - used + buffers + cache As per above outputs totFree = hrStorageSize.1 - hrStorageUsed.1 + hrStorageUsed.6 + hrStorageUsed.7 = 19799404 - 6792488 + 280040 + 2447248 = 15734204 KB As per free output total free memory would be as follows : # free total used free shared buff/cache available Mem: 19799404 3709992 13008312 846124 3081100 14787728 Swap: 10027004 0 10027004 totFree = free + buff/cache = 13008312 + 3081100 = 16089412 KB Here is the discrepancy in memory usage between net-snmp and free. Though both free and HOST-RESOURCES-MIB get their data from /proc/meminfo, but use slightly different metrics. From man free: buffers : Memory used by kernel buffers (Buffers in /proc/meminfo) cache : Memory used by the page cache and slabs (Cached and Slab in /proc/meminfo) So free includes slab allocation in cache, while HOST-RESOURCES-MIB doesn't. If we get the slab allocation: # grep Slab /proc/meminfo Slab: 353696 kB and add it to what we got from SNMP, we have: totFree = 15734204 + 353696 = 16087900 KB Is it possible to include slab allocation in net-snmp memroy usage ? Version-Release number of selected component (if applicable): net-snmp-5.7.2-24.el7_3.2.x86_64 How reproducible: 1. Install net-snmp 2. Start the service 3. Collect memory usage using net-snmp Steps to Reproduce: 1. Check memory usage using net-snmp 2. Check memory usage using free command 3. Compare the memory usage Actual results: net-snmp over estimates memory usage on the system Expected results: net-snmp and free should show similar memory usage Additional info: slab allocation is not considered by net-snmp memory usage