]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
memory plugin: Report "shared" memory (Linux only).
authorFlorian Forster <octo@collectd.org>
Thu, 4 Jan 2024 08:17:23 +0000 (09:17 +0100)
committerFlorian Forster <octo@collectd.org>
Mon, 15 Jan 2024 14:21:58 +0000 (15:21 +0100)
src/memory.c

index a7519176110706bd146fbaf966c41ef27a227960..9973feb1eb1acdfe7e74a4ea6da1b29709ba4604 100644 (file)
@@ -67,6 +67,7 @@ static char const *const label_state = "system.memory.state";
 typedef enum {
   STATE_USED,
   STATE_FREE,
+  STATE_SHARED,
   STATE_BUFFERS,
   STATE_CACHED,
   STATE_WIRED,
@@ -82,9 +83,9 @@ typedef enum {
 } memory_type_t;
 
 static char const *memory_type_names[STATE_MAX] = {
-    "used",     "free",      "buffers", "cached", "wired",
-    "active",   "inactive",  "kernel",  "locked", "arc",
-    "unusable", "user_wire", "laundry",
+    "used",  "free",     "shared",    "buffers", "cached",
+    "wired", "active",   "inactive",  "kernel",  "locked",
+    "arc",   "unusable", "user_wire", "laundry",
 };
 
 /* vm_statistics_data_t */
@@ -445,6 +446,9 @@ static int memory_read_internal(gauge_t values[STATE_MAX]) {
     } else if (strcmp(fields[0], "Cached:") == 0) {
       values[STATE_CACHED] = v;
       mem_not_used += v;
+    } else if (strcmp(fields[0], "Shmem:") == 0) {
+      values[STATE_SHARED] = v;
+      mem_not_used += v;
     }
   }