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