]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
cpu plugin: Actually set the metric value.
authorFlorian Forster <octo@google.com>
Mon, 29 Jun 2020 08:35:35 +0000 (10:35 +0200)
committerFlorian Forster <octo@google.com>
Wed, 29 Jul 2020 11:40:03 +0000 (13:40 +0200)
Fixes a regression introduced in 18b6e8502e6acdb79d5d55ac6dca38fc6e98dc13.

src/cpu.c

index f20d5d4349f557e7f5015b8a0a767954c72b37fc..6e644b9264e744a45162f681b68e5284ee41034c 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
@@ -488,7 +488,7 @@ static void cpu_commit_num_cpu(gauge_t value) /* {{{ */
 {
   metric_family_t fam = {
       .name = "cpu_count",
-      .type = VALUE_TYPE_GAUGE,
+      .type = METRIC_TYPE_GAUGE,
   };
   metric_family_metric_append(&fam, (metric_t){
                                         .value.gauge = value,
@@ -518,7 +518,7 @@ static void cpu_commit_without_aggregation(void) /* {{{ */
 {
   metric_family_t fam = {
       .name = "cpu_usage_total",
-      .type = VALUE_TYPE_DERIVE,
+      .type = METRIC_TYPE_COUNTER,
   };
 
   metric_t m = {0};
@@ -536,6 +536,8 @@ static void cpu_commit_without_aggregation(void) /* {{{ */
       snprintf(cpu_num_str, sizeof(cpu_num_str), "%zu", cpu_num);
       metric_label_set(&m, "cpu", cpu_num_str);
 
+      m.value.derive = s->conv.last_value.derive;
+
       metric_family_metric_append(&fam, m);
     }
   }