From f9191af92d13ed2344de2850befd07489c455fe1 Mon Sep 17 00:00:00 2001 From: Phillip Whelan Date: Mon, 6 Nov 2023 20:36:42 -0300 Subject: [PATCH] in_node_exporter_metrics: thermal_zone: define the new collector for thermal_zone. Signed-off-by: Phillip Whelan --- .../in_node_exporter_metrics/ne_thermalzone.c | 2 +- .../ne_thermalzone_linux.c | 25 ++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/plugins/in_node_exporter_metrics/ne_thermalzone.c b/plugins/in_node_exporter_metrics/ne_thermalzone.c index 3b6eae2d457..9c540740c78 100644 --- a/plugins/in_node_exporter_metrics/ne_thermalzone.c +++ b/plugins/in_node_exporter_metrics/ne_thermalzone.c @@ -24,7 +24,7 @@ #include "ne.h" struct flb_ne_collector thermalzone_collector = { - .name = "thermalzone", + .name = "thermal_zone", .cb_init = NULL, .cb_update = NULL, .cb_exit = NULL diff --git a/plugins/in_node_exporter_metrics/ne_thermalzone_linux.c b/plugins/in_node_exporter_metrics/ne_thermalzone_linux.c index aaa545ef162..f4f38479077 100644 --- a/plugins/in_node_exporter_metrics/ne_thermalzone_linux.c +++ b/plugins/in_node_exporter_metrics/ne_thermalzone_linux.c @@ -38,7 +38,7 @@ * ---------------------------------------------------------- */ -int ne_thermalzone_init(struct flb_ne *ctx) +static int ne_thermalzone_init(struct flb_ne *ctx) { ctx->thermalzone_temp = cmt_gauge_create(ctx->cmt, "node", "thermal_zone", "temp", "Zone temperature in Celsius", @@ -69,7 +69,7 @@ int ne_thermalzone_init(struct flb_ne *ctx) return 0; } -int ne_thermalzone_update_thermal_zones(struct flb_ne *ctx) +static int ne_thermalzone_update_thermal_zones(struct flb_ne *ctx) { uint64_t tstamp; int ret; @@ -154,7 +154,7 @@ int ne_thermalzone_update_thermal_zones(struct flb_ne *ctx) return 0; } -int ne_thermalzone_update_cooling_devices(struct flb_ne *ctx) +static int ne_thermalzone_update_cooling_devices(struct flb_ne *ctx) { uint64_t tstamp; int ret; @@ -246,3 +246,22 @@ int ne_thermalzone_update_cooling_devices(struct flb_ne *ctx) return 0; } + +static int ne_thermalzone_update(struct flb_input_instance *ins, struct flb_config *config, void *in_context) +{ + int ret; + struct flb_ne *ctx = (struct flb_ne *)in_context; + + ret = ne_thermalzone_update_thermal_zones(ctx); + if (ret != 0) { + return ret; + } + return ne_thermalzone_update_cooling_devices(ctx); +} + +struct flb_ne_collector thermalzone_collector = { + .name = "thermal_zone", + .cb_init = ne_thermalzone_init, + .cb_update = ne_thermalzone_update, + .cb_exit = NULL +};