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 @@ -7,6 +7,7 @@ set(src
ne_stat.c
ne_vmstat.c
ne_netdev.c
ne_netstat.c
ne_sockstat.c
Comment on lines 8 to 11

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0 Badge Reference netstat collector without adding implementation

The new build sources list ne_netstat.c and ne.c now includes ne_netstat.h/netstat_collector, but there is no ne_netstat.* file anywhere in the repository. During configuration CMake will fail with “Cannot find source file "ne_netstat.c"”, preventing the node_exporter_metrics plugin from compiling. The collector implementation needs to be added (or the references removed) for the build to succeed.

Useful? React with 👍 / 👎.

ne_time.c
ne_loadavg.c
Expand Down
8 changes: 8 additions & 0 deletions plugins/in_node_exporter_metrics/ne.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "ne_loadavg.h"
#include "ne_vmstat.h"
#include "ne_netdev.h"
#include "ne_netstat.h"
#include "ne_sockstat.h"
#include "ne_textfile.h"
#include "ne_systemd.h"
Expand Down Expand Up @@ -194,6 +195,7 @@ static int in_ne_init(struct flb_input_instance *in,
mk_list_add(&loadavg_collector._head, &ctx->collectors);
mk_list_add(&vmstat_collector._head, &ctx->collectors);
mk_list_add(&netdev_collector._head, &ctx->collectors);
mk_list_add(&netstat_collector._head, &ctx->collectors);
mk_list_add(&sockstat_collector._head, &ctx->collectors);
mk_list_add(&filefd_collector._head, &ctx->collectors);
mk_list_add(&textfile_collector._head, &ctx->collectors);
Expand Down Expand Up @@ -389,6 +391,12 @@ static struct flb_config_map config_map[] = {
"scrape interval to collect netdev metrics from the node."
},

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

{
FLB_CONFIG_MAP_TIME, "collector.sockstat.scrape_interval", "0",
0, FLB_FALSE, 0,
Expand Down
12 changes: 11 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,hwmon"
#define NE_DEFAULT_ENABLED_METRICS "cpu,cpufreq,meminfo,diskstats,filesystem,uname,stat,time,loadavg,vmstat,netdev,netstat,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 @@ -163,6 +163,16 @@ struct flb_ne {
struct cmt_gauge *sockstat_FRAG6_inuse;
struct cmt_gauge *sockstat_FRAG6_memory;

/* netstat_linux */
struct cmt_gauge *netstat_Tcp_CurrEstab;
struct cmt_counter *netstat_Tcp_ActiveOpens;
struct cmt_counter *netstat_Tcp_PassiveOpens;
struct cmt_counter *netstat_Tcp_RetransSegs;
struct cmt_counter *netstat_Udp_InDatagrams;
struct cmt_counter *netstat_Udp_InErrors;
struct cmt_counter *netstat_Udp_OutDatagrams;
struct cmt_counter *netstat_Udp_NoPorts;

/* time */
struct cmt_gauge *time;

Expand Down
33 changes: 33 additions & 0 deletions plugins/in_node_exporter_metrics/ne_netstat.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-2025 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_netstat_linux.c"
#else

#include "ne.h"

struct flb_ne_collector netstat_collector = {
.name = "netstat",
.cb_init = NULL,
.cb_update = NULL,
.cb_exit = NULL
};

#endif
27 changes: 27 additions & 0 deletions plugins/in_node_exporter_metrics/ne_netstat.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-2025 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_NETSTAT_H
#define FLB_IN_NE_NETSTAT_H

#include "ne.h"

extern struct flb_ne_collector netstat_collector;

#endif
Loading
Loading