From 9fa47596adc1ba467e96d525fabc57cc69391c7a Mon Sep 17 00:00:00 2001 From: Packit Service Date: Jan 07 2021 06:13:56 +0000 Subject: Apply patch net-snmp-5.8-memory-reporting.patch patch_name: net-snmp-5.8-memory-reporting.patch present_in_specfile: true --- diff --git a/agent/mibgroup/hardware/memory/memory_linux.c b/agent/mibgroup/hardware/memory/memory_linux.c index 6c20d95..2e972df 100644 --- a/agent/mibgroup/hardware/memory/memory_linux.c +++ b/agent/mibgroup/hardware/memory/memory_linux.c @@ -29,7 +29,7 @@ int netsnmp_mem_arch_load( netsnmp_cache *cache, void *magic ) { ssize_t bytes_read; char *b; unsigned long memtotal = 0, memfree = 0, memshared = 0, - buffers = 0, cached = 0, + buffers = 0, cached = 0, sreclaimable = 0, swaptotal = 0, swapfree = 0; netsnmp_memory_info *mem; @@ -127,6 +127,13 @@ int netsnmp_mem_arch_load( netsnmp_cache *cache, void *magic ) { if (first) snmp_log(LOG_ERR, "No SwapTotal line in /proc/meminfo\n"); } + b = strstr(buff, "SReclaimable: "); + if (b) + sscanf(b, "SReclaimable: %lu", &sreclaimable); + else { + if (first) + snmp_log(LOG_ERR, "No SReclaimable line in /proc/meminfo\n"); + } b = strstr(buff, "SwapFree: "); if (b) sscanf(b, "SwapFree: %lu", &swapfree); @@ -183,7 +190,7 @@ int netsnmp_mem_arch_load( netsnmp_cache *cache, void *magic ) { if (!mem->descr) mem->descr = strdup("Cached memory"); mem->units = 1024; - mem->size = cached; + mem->size = cached+sreclaimable; mem->free = 0; /* Report cached size/used as equal */ mem->other = -1; }