Blame SOURCES/net-snmp-5.8-memory-reporting.patch

0e8785
diff -urNp a/agent/mibgroup/hardware/memory/memory_linux.c b/agent/mibgroup/hardware/memory/memory_linux.c
0e8785
--- a/agent/mibgroup/hardware/memory/memory_linux.c	2020-06-10 13:36:40.164588176 +0200
0e8785
+++ b/agent/mibgroup/hardware/memory/memory_linux.c	2020-06-10 13:38:59.398944829 +0200
0e8785
@@ -29,7 +29,7 @@ int netsnmp_mem_arch_load( netsnmp_cache
0e8785
     ssize_t      bytes_read;
0e8785
     char        *b;
0e8785
     unsigned long memtotal = 0,  memfree = 0, memshared = 0,
0e8785
-                  buffers = 0,   cached = 0,
0e8785
+                  buffers = 0,   cached = 0, sreclaimable = 0,
0e8785
                   swaptotal = 0, swapfree = 0;
0e8785
 
0e8785
     netsnmp_memory_info *mem;
0e8785
@@ -127,6 +127,13 @@ int netsnmp_mem_arch_load( netsnmp_cache
0e8785
         if (first)
0e8785
             snmp_log(LOG_ERR, "No SwapTotal line in /proc/meminfo\n");
0e8785
     }
0e8785
+    b = strstr(buff, "SReclaimable: ");
0e8785
+    if (b)
0e8785
+        sscanf(b, "SReclaimable: %lu", &sreclaimable);
0e8785
+    else {
0e8785
+        if (first)
0e8785
+            snmp_log(LOG_ERR, "No SReclaimable line in /proc/meminfo\n");
0e8785
+    }
0e8785
     b = strstr(buff, "SwapFree: ");
0e8785
     if (b)
0e8785
         sscanf(b, "SwapFree: %lu", &swapfree);
0e8785
@@ -183,7 +190,7 @@ int netsnmp_mem_arch_load( netsnmp_cache
0e8785
         if (!mem->descr)
0e8785
              mem->descr = strdup("Cached memory");
0e8785
         mem->units = 1024;
0e8785
-        mem->size  = cached;
0e8785
+        mem->size  = cached+sreclaimable;
0e8785
         mem->free  = 0;     /* Report cached size/used as equal */
0e8785
         mem->other = -1;
0e8785
     }