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