Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugins/in_node_exporter_metrics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ set(src
ne_textfile.c
ne_processes.c
ne_nvme.c
ne_hwmon.c
ne_utils.c
ne_config.c
ne_systemd.c
Expand Down
33 changes: 33 additions & 0 deletions plugins/in_node_exporter_metrics/ne.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "ne_processes.h"
#include "ne_nvme.h"
#include "ne_thermalzone.h"
#include "ne_hwmon.h"

/*
* Update the metrics, this function is invoked every time 'scrape_interval'
Expand Down Expand Up @@ -200,6 +201,7 @@ static int in_ne_init(struct flb_input_instance *in,
mk_list_add(&processes_collector._head, &ctx->collectors);
mk_list_add(&nvme_collector._head, &ctx->collectors);
mk_list_add(&thermalzone_collector._head, &ctx->collectors);
mk_list_add(&hwmon_collector._head, &ctx->collectors);

mk_list_foreach(head, &ctx->collectors) {
coll = mk_list_entry(head, struct flb_ne_collector, _head);
Expand Down Expand Up @@ -428,6 +430,12 @@ static struct flb_config_map config_map[] = {
"scrape interval to collect nvme metrics from the node."
},

{
FLB_CONFIG_MAP_TIME, "collector.hwmon.scrape_interval", "0",
0, FLB_FALSE, 0,
"scrape interval to collect hwmon metrics from the node."
},

{
FLB_CONFIG_MAP_CLIST, "metrics",
NE_DEFAULT_ENABLED_METRICS,
Expand Down Expand Up @@ -503,6 +511,31 @@ static struct flb_config_map config_map[] = {
0, FLB_TRUE, offsetof(struct flb_ne, dt_regex_skip_devices_text),
"ignore regular expression for disk devices"
},

/* hwmon specific settings */
{
FLB_CONFIG_MAP_STR, "collector.hwmon.chip-include", NULL,
0, FLB_TRUE, offsetof(struct flb_ne, hwmon_chip_regex_include_text),
"regex of chips to include"
},

{
FLB_CONFIG_MAP_STR, "collector.hwmon.chip-exclude", NULL,
0, FLB_TRUE, offsetof(struct flb_ne, hwmon_chip_regex_exclude_text),
"regex of chips to exclude"
},

{
FLB_CONFIG_MAP_STR, "collector.hwmon.sensor-include", NULL,
0, FLB_TRUE, offsetof(struct flb_ne, hwmon_sensor_regex_include_text),
"regex of sensors to include"
},

{
FLB_CONFIG_MAP_STR, "collector.hwmon.sensor-exclude", NULL,
0, FLB_TRUE, offsetof(struct flb_ne, hwmon_sensor_regex_exclude_text),
"regex of sensors to exclude"
},
/* EOF */
{0}
};
Expand Down
18 changes: 17 additions & 1 deletion plugins/in_node_exporter_metrics/ne.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
/* Default enabled metrics */

#ifdef __linux__
#define NE_DEFAULT_ENABLED_METRICS "cpu,cpufreq,meminfo,diskstats,filesystem,uname,stat,time,loadavg,vmstat,netdev,sockstat,filefd,systemd,nvme,thermal_zone"
#define NE_DEFAULT_ENABLED_METRICS "cpu,cpufreq,meminfo,diskstats,filesystem,uname,stat,time,loadavg,vmstat,netdev,sockstat,filefd,systemd,nvme,thermal_zone,hwmon"
#elif __APPLE__
#define NE_DEFAULT_ENABLED_METRICS "cpu,loadavg,meminfo,diskstats,uname,netdev"
#endif
Expand Down Expand Up @@ -233,6 +233,22 @@ struct flb_ne {
struct cmt_gauge *thermalzone_temp;
struct cmt_gauge *cooling_device_cur_state;
struct cmt_gauge *cooling_device_max_state;

/* hwmon */
struct cmt_gauge *hwmon_temp_celsius;
struct cmt_gauge *hwmon_temp_max_celsius;
struct cmt_gauge *hwmon_temp_crit_celsius;
struct cmt_gauge *hwmon_in_volts;
struct cmt_gauge *hwmon_fan_rpm;
struct cmt_gauge *hwmon_power_watts;
flb_sds_t hwmon_chip_regex_include_text;
flb_sds_t hwmon_chip_regex_exclude_text;
flb_sds_t hwmon_sensor_regex_include_text;
flb_sds_t hwmon_sensor_regex_exclude_text;
struct flb_regex *hwmon_chip_regex_include;
struct flb_regex *hwmon_chip_regex_exclude;
struct flb_regex *hwmon_sensor_regex_include;
struct flb_regex *hwmon_sensor_regex_exclude;
};

struct flb_ne_collector {
Expand Down
33 changes: 33 additions & 0 deletions plugins/in_node_exporter_metrics/ne_hwmon.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */

/* Fluent Bit
* ==========
* Copyright (C) 2015-2024 The Fluent Bit Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifdef __linux__
#include "ne_hwmon_linux.c"
#else

#include "ne.h"

struct flb_ne_collector hwmon_collector = {
.name = "hwmon",
.cb_init = NULL,
.cb_update = NULL,
.cb_exit = NULL
};

#endif
27 changes: 27 additions & 0 deletions plugins/in_node_exporter_metrics/ne_hwmon.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */

/* Fluent Bit
* ==========
* Copyright (C) 2015-2024 The Fluent Bit Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef FLB_IN_NE_HWMON_H
#define FLB_IN_NE_HWMON_H

#include "ne.h"

extern struct flb_ne_collector hwmon_collector;

#endif
Loading
Loading