Blame SOURCES/net-snmp-5.7.2-memory.patch

19bbc3
diff -urNp c/agent/mibgroup/hardware/memory/memory_linux.c d/agent/mibgroup/hardware/memory/memory_linux.c
19bbc3
--- c/agent/mibgroup/hardware/memory/memory_linux.c	2019-04-10 14:07:47.375285001 +0200
19bbc3
+++ d/agent/mibgroup/hardware/memory/memory_linux.c	2019-04-12 11:39:11.677314245 +0200
19bbc3
@@ -29,7 +29,7 @@ int netsnmp_mem_arch_load( netsnmp_cache
19bbc3
     ssize_t      bytes_read;
19bbc3
     char        *b;
19bbc3
     unsigned long memtotal = 0,  memfree = 0, memshared = 0,
19bbc3
-                  buffers = 0,   cached = 0,
19bbc3
+                  buffers = 0,   cached = 0, sreclaimable = 0,
19bbc3
                   swaptotal = 0, swapfree = 0;
19bbc3
 
19bbc3
     netsnmp_memory_info *mem;
19bbc3
@@ -126,6 +126,13 @@ int netsnmp_mem_arch_load( netsnmp_cache
19bbc3
         if (first)
19bbc3
             snmp_log(LOG_ERR, "No SwapTotal line in /proc/meminfo\n");
19bbc3
     }
19bbc3
+    b = strstr(buff, "SReclaimable: ");
19bbc3
+    if (b)
19bbc3
+        sscanf(b, "SReclaimable: %lu", &sreclaimable);
19bbc3
+    else {
19bbc3
+        if (first)
19bbc3
+            snmp_log(LOG_ERR, "No SReclaimable line in /proc/meminfo\n");
19bbc3
+    }
19bbc3
     b = strstr(buff, "SwapFree: ");
19bbc3
     if (b)
19bbc3
         sscanf(b, "SwapFree: %lu", &swapfree);
19bbc3
@@ -182,7 +189,7 @@ int netsnmp_mem_arch_load( netsnmp_cache
19bbc3
         if (!mem->descr)
19bbc3
              mem->descr = strdup("Cached memory");
19bbc3
         mem->units = 1024;
19bbc3
-        mem->size  = cached;
19bbc3
+        mem->size  = cached+sreclaimable;
19bbc3
         mem->free  = 0;     /* Report cached size/used as equal */
19bbc3
         mem->other = -1;
19bbc3
     }