]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
memory plugin: Rename `ValuesAbsolute` to `ReportUsage`.
authorFlorian Forster <octo@collectd.org>
Thu, 4 Jan 2024 06:23:28 +0000 (07:23 +0100)
committerFlorian Forster <octo@collectd.org>
Mon, 15 Jan 2024 14:21:58 +0000 (15:21 +0100)
src/collectd.conf.in
src/collectd.conf.pod
src/memory.c

index d0d1a90c7fc5020a975ddb0a4b8d00adfc145454..4135898f4528666bb9394fd11f83976b5348b179 100644 (file)
 #</Plugin>
 
 #<Plugin memory>
-#      ValuesAbsolute true
+#      ReportUsage true
 #      ValuesPercentage false
 #</Plugin>
 
index 761b00f30794cc047d392e517c114a9940ce2fcf..6870342c198b0319b21e630998b77aebc95f03e2 100644 (file)
@@ -5269,7 +5269,7 @@ The I<memory plugin> provides the following configuration options:
 
 =over 4
 
-=item B<ValuesAbsolute> B<true>|B<false>
+=item B<ReportUsage> B<true>|B<false>
 
 Enables or disables reporting of physical memory usage in absolute numbers,
 i.e. bytes. Defaults to B<true>.
index e2ee21b6e164581c99b04b4f506f60e4bb9410ab..081d0a31f98be92a3669fb6c53e19ee32ed78daf 100644 (file)
@@ -149,15 +149,16 @@ static int pagesize;
 #include <uvm/uvm_extern.h>
 #endif
 
-static bool values_absolute = true;
+static bool report_usage = true;
 static bool values_percentage;
 
 static int memory_config(oconfig_item_t *ci) /* {{{ */
 {
   for (int i = 0; i < ci->children_num; i++) {
     oconfig_item_t *child = ci->children + i;
-    if (strcasecmp("ValuesAbsolute", child->key) == 0)
-      cf_util_get_boolean(child, &values_absolute);
+    if (strcasecmp("ReportUsage", child->key) == 0 ||
+        strcasecmp("ValuesAbsolute", child->key) == 0)
+      cf_util_get_boolean(child, &report_usage);
     else if (strcasecmp("ValuesPercentage", child->key) == 0)
       cf_util_get_boolean(child, &values_percentage);
     else
@@ -168,7 +169,7 @@ static int memory_config(oconfig_item_t *ci) /* {{{ */
 } /* }}} int memory_config */
 
 static int memory_dispatch(gauge_t values[COLLECTD_MEMORY_TYPE_MAX]) {
-  metric_family_t fam_absolute = {
+  metric_family_t fam_usage = {
       .name = "system.memory.usage",
       .help = "Reports memory in use by state",
       .unit = "By",
@@ -183,22 +184,22 @@ static int memory_dispatch(gauge_t values[COLLECTD_MEMORY_TYPE_MAX]) {
 
     total += values[i];
 
-    if (values_absolute) {
-      metric_family_append(&fam_absolute, label_state, memory_type_names[i],
+    if (report_usage) {
+      metric_family_append(&fam_usage, label_state, memory_type_names[i],
                            (value_t){.gauge = values[i]}, NULL);
     }
   }
 
   int ret = 0;
-  if (values_absolute) {
-    int status = plugin_dispatch_metric_family(&fam_absolute);
+  if (report_usage) {
+    int status = plugin_dispatch_metric_family(&fam_usage);
     if (status != 0) {
       ERROR("memory plugin: plugin_dispatch_metric_family failed: %s",
             STRERROR(status));
     }
     ret = status;
   }
-  metric_family_metric_reset(&fam_absolute);
+  metric_family_metric_reset(&fam_usage);
 
   if (!values_percentage) {
     return ret;