Skip to content

Commit

Permalink
in_node_exporter_metrics: thermal_zone: define the new collector for …
Browse files Browse the repository at this point in the history
…thermal_zone.

Signed-off-by: Phillip Whelan <[email protected]>
  • Loading branch information
pwhelan committed Nov 7, 2023
1 parent 7fdf945 commit f9191af
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion plugins/in_node_exporter_metrics/ne_thermalzone.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 22 additions & 3 deletions plugins/in_node_exporter_metrics/ne_thermalzone_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
};

0 comments on commit f9191af

Please sign in to comment.