Skip to content

Commit 65769cd

Browse files
committed
add nodeExporter.collectors.netclass settings.
1 parent bf292f5 commit 65769cd

File tree

10 files changed

+124
-0
lines changed

10 files changed

+124
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- [#1876](https://github.com/openshift/cluster-monitoring-operator/pull/1876) Add nodeExporter.collectors.tcpstat settings.
1212
- [#1888](https://github.com/openshift/cluster-monitoring-operator/pull/1888) Add nodeExporter.collectors.netdev settings.
1313
- [#1884](https://github.com/openshift/cluster-monitoring-operator/issues/1882) Allow configuring secrets in alertmanager component (UWM)
14+
- [#1893](https://github.com/openshift/cluster-monitoring-operator/pull/1893) Add nodeExporter.collectors.netclass settings.
1415

1516

1617
## 4.12

Documentation/api.md

+17
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Configuring Cluster Monitoring is optional. If the config does not exist or is e
2727
* [KubeStateMetricsConfig](#kubestatemetricsconfig)
2828
* [NodeExporterCollectorConfig](#nodeexportercollectorconfig)
2929
* [NodeExporterCollectorCpufreqConfig](#nodeexportercollectorcpufreqconfig)
30+
* [NodeExporterCollectorNetClassConfig](#nodeexportercollectornetclassconfig)
3031
* [NodeExporterCollectorNetDevConfig](#nodeexportercollectornetdevconfig)
3132
* [NodeExporterCollectorTcpStatConfig](#nodeexportercollectortcpstatconfig)
3233
* [NodeExporterConfig](#nodeexporterconfig)
@@ -193,6 +194,7 @@ The `NodeExporterCollectorConfig` resource defines settings for individual colle
193194
| cpufreq | [NodeExporterCollectorCpufreqConfig](#nodeexportercollectorcpufreqconfig) | Defines the configuration of the `cpufreq` collector, which collects CPU frequency statistics. Disabled by default. |
194195
| tcpstat | [NodeExporterCollectorTcpStatConfig](#nodeexportercollectortcpstatconfig) | Defines the configuration of the `tcpstat` collector, which collects TCP connection statistics. Disabled by default. |
195196
| netdev | [NodeExporterCollectorNetDevConfig](#nodeexportercollectornetdevconfig) | Defines the configuration of the `netdev` collector, which collects network devices statistics. Enabled by default. |
197+
| netclass | [NodeExporterCollectorNetClassConfig](#nodeexportercollectornetclassconfig) | Defines the configuration of the `netclass` collector, which collects information about network devices. Enabled by default. |
196198

197199
[Back to TOC](#table-of-contents)
198200

@@ -211,6 +213,21 @@ The `NodeExporterCollectorCpufreqConfig` resource works as an on/off switch for
211213

212214
[Back to TOC](#table-of-contents)
213215

216+
## NodeExporterCollectorNetClassConfig
217+
218+
#### Description
219+
220+
The `NodeExporterCollectorNetClassConfig` resource works as an on/off switch for the `netclass` collector of the `node-exporter` agent. By default, the `netclass` collector is enabled. If disabled, these metrics become unavailable: `node_network_info`, `node_network_address_assign_type`, `node_network_carrier`, `node_network_carrier_changes_total`, `node_network_carrier_up_changes_total`, `node_network_carrier_down_changes_total`, `node_network_device_id`, `node_network_dormant`, `node_network_flags`, `node_network_iface_id`, `node_network_iface_link`, `node_network_iface_link_mode`, `node_network_mtu_bytes`, `node_network_name_assign_type`, `node_network_net_dev_group`, `node_network_speed_bytes`, `node_network_transmit_queue_length`, `node_network_protocol_type`.
221+
222+
223+
<em>appears in: [NodeExporterCollectorConfig](#nodeexportercollectorconfig)</em>
224+
225+
| Property | Type | Description |
226+
| -------- | ---- | ----------- |
227+
| enabled | bool | A Boolean flag that enables or disables the `netclass` collector. |
228+
229+
[Back to TOC](#table-of-contents)
230+
214231
## NodeExporterCollectorNetDevConfig
215232

216233
#### Description

Documentation/openshiftdocs/index.adoc

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ The configuration file itself is always defined under the `config.yaml` key in t
4747
* link:modules/kubestatemetricsconfig.adoc[KubeStateMetricsConfig]
4848
* link:modules/nodeexportercollectorconfig.adoc[NodeExporterCollectorConfig]
4949
* link:modules/nodeexportercollectorcpufreqconfig.adoc[NodeExporterCollectorCpufreqConfig]
50+
* link:modules/nodeexportercollectornetclassconfig.adoc[NodeExporterCollectorNetClassConfig]
5051
* link:modules/nodeexportercollectornetdevconfig.adoc[NodeExporterCollectorNetDevConfig]
5152
* link:modules/nodeexportercollectortcpstatconfig.adoc[NodeExporterCollectorTcpStatConfig]
5253
* link:modules/nodeexporterconfig.adoc[NodeExporterConfig]

Documentation/openshiftdocs/modules/nodeexportercollectorconfig.adoc

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ Appears in: link:nodeexporterconfig.adoc[NodeExporterConfig]
2424

2525
|netdev|link:nodeexportercollectornetdevconfig.adoc[NodeExporterCollectorNetDevConfig]|Defines the configuration of the `netdev` collector, which collects network devices statistics. Enabled by default.
2626

27+
|netclass|link:nodeexportercollectornetclassconfig.adoc[NodeExporterCollectorNetClassConfig]|Defines the configuration of the `netclass` collector, which collects information about network devices. Enabled by default.
28+
2729
|===
2830

2931
link:../index.adoc[Back to TOC]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// DO NOT EDIT THE CONTENT IN THIS FILE. It is automatically generated from the
2+
// source code for the Cluster Monitoring Operator. Any changes made to this
3+
// file will be overwritten when the content is re-generated. If you wish to
4+
// make edits, read the docgen utility instructions in the source code for the
5+
// CMO.
6+
:_content-type: ASSEMBLY
7+
8+
== NodeExporterCollectorNetClassConfig
9+
10+
=== Description
11+
12+
The `NodeExporterCollectorNetClassConfig` resource works as an on/off switch for the `netclass` collector of the `node-exporter` agent. By default, the `netclass` collector is enabled. If disabled, these metrics become unavailable: `node_network_info`, `node_network_address_assign_type`, `node_network_carrier`, `node_network_carrier_changes_total`, `node_network_carrier_up_changes_total`, `node_network_carrier_down_changes_total`, `node_network_device_id`, `node_network_dormant`, `node_network_flags`, `node_network_iface_id`, `node_network_iface_link`, `node_network_iface_link_mode`, `node_network_mtu_bytes`, `node_network_name_assign_type`, `node_network_net_dev_group`, `node_network_speed_bytes`, `node_network_transmit_queue_length`, `node_network_protocol_type`.
13+
14+
15+
16+
Appears in: link:nodeexportercollectorconfig.adoc[NodeExporterCollectorConfig]
17+
18+
[options="header"]
19+
|===
20+
| Property | Type | Description
21+
|enabled|bool|A Boolean flag that enables or disables the `netclass` collector.
22+
23+
|===
24+
25+
link:../index.adoc[Back to TOC]

pkg/manifests/config.go

+3
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,9 @@ func defaultClusterMonitoringConfiguration() ClusterMonitoringConfiguration {
207207
NetDev: NodeExporterCollectorNetDevConfig{
208208
Enabled: true,
209209
},
210+
NetClass: NodeExporterCollectorNetClassConfig{
211+
Enabled: true,
212+
},
210213
},
211214
},
212215
}

pkg/manifests/manifests.go

+6
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,12 @@ func (f *Factory) updateNodeExporterArgs(args []string) []string {
824824
args = setArg(args, "--no-collector.netdev", "")
825825
}
826826

827+
if f.config.ClusterMonitoringConfiguration.NodeExporterConfig.Collectors.NetClass.Enabled {
828+
args = setArg(args, "--collector.netclass", "")
829+
} else {
830+
args = setArg(args, "--no-collector.netclass", "")
831+
}
832+
827833
return args
828834
}
829835

pkg/manifests/manifests_test.go

+13
Original file line numberDiff line numberDiff line change
@@ -2859,10 +2859,12 @@ func TestNodeExporterCollectorSettings(t *testing.T) {
28592859
argsPresent: []string{"--no-collector.cpufreq",
28602860
"--no-collector.tcpstat",
28612861
"--collector.netdev",
2862+
"--collector.netclass",
28622863
},
28632864
argsAbsent: []string{"--collector.cpufreq",
28642865
"--collector.tcpstat",
28652866
"--no-collector.netdev",
2867+
"--no-collector.netclass",
28662868
},
28672869
},
28682870
{
@@ -2898,6 +2900,17 @@ nodeExporter:
28982900
argsPresent: []string{"--no-collector.netdev"},
28992901
argsAbsent: []string{"--collector.netdev"},
29002902
},
2903+
{
2904+
name: "disable netclass collector",
2905+
config: `
2906+
nodeExporter:
2907+
collectors:
2908+
netclass:
2909+
enabled: false
2910+
`,
2911+
argsPresent: []string{"--no-collector.netclass"},
2912+
argsAbsent: []string{"--collector.netclass"},
2913+
},
29012914
}
29022915

29032916
for _, test := range tests {

pkg/manifests/types.go

+30
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,9 @@ type NodeExporterCollectorConfig struct {
267267
// Defines the configuration of the `netdev` collector, which collects network devices statistics.
268268
// Enabled by default.
269269
NetDev NodeExporterCollectorNetDevConfig `json:"netdev,omitempty"`
270+
// Defines the configuration of the `netclass` collector, which collects information about network devices.
271+
// Enabled by default.
272+
NetClass NodeExporterCollectorNetClassConfig `json:"netclass,omitempty"`
270273
}
271274

272275
// The `NodeExporterCollectorCpufreqConfig` resource works as an on/off switch for
@@ -315,6 +318,33 @@ type NodeExporterCollectorNetDevConfig struct {
315318
Enabled bool `json:"enabled,omitempty"`
316319
}
317320

321+
// The `NodeExporterCollectorNetClassConfig` resource works as an on/off switch for
322+
// the `netclass` collector of the `node-exporter` agent.
323+
// By default, the `netclass` collector is enabled.
324+
// If disabled, these metrics become unavailable:
325+
// `node_network_info`,
326+
// `node_network_address_assign_type`,
327+
// `node_network_carrier`,
328+
// `node_network_carrier_changes_total`,
329+
// `node_network_carrier_up_changes_total`,
330+
// `node_network_carrier_down_changes_total`,
331+
// `node_network_device_id`,
332+
// `node_network_dormant`,
333+
// `node_network_flags`,
334+
// `node_network_iface_id`,
335+
// `node_network_iface_link`,
336+
// `node_network_iface_link_mode`,
337+
// `node_network_mtu_bytes`,
338+
// `node_network_name_assign_type`,
339+
// `node_network_net_dev_group`,
340+
// `node_network_speed_bytes`,
341+
// `node_network_transmit_queue_length`,
342+
// `node_network_protocol_type`.
343+
type NodeExporterCollectorNetClassConfig struct {
344+
// A Boolean flag that enables or disables the `netclass` collector.
345+
Enabled bool `json:"enabled,omitempty"`
346+
}
347+
318348
// The `UserWorkloadConfiguration` resource defines the settings
319349
// responsible for user-defined projects in the
320350
// `user-workload-monitoring-config` config map in the

test/e2e/node_exporter_test.go

+26
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,32 @@ nodeExporter:
126126
"node_network_transmit_packets_total",
127127
},
128128
},
129+
{
130+
nameCollector: "netclass",
131+
config: `
132+
nodeExporter:
133+
collectors:
134+
netclass:
135+
enabled: false`,
136+
metrics: []string{
137+
"node_network_carrier",
138+
"node_network_carrier_changes_total",
139+
"node_network_carrier_down_changes_total",
140+
"node_network_carrier_up_changes_total",
141+
"node_network_dormant",
142+
"node_network_flags",
143+
"node_network_iface_id",
144+
"node_network_iface_link",
145+
"node_network_iface_link_mode",
146+
"node_network_info",
147+
"node_network_mtu_bytes",
148+
"node_network_net_dev_group",
149+
"node_network_protocol_type",
150+
"node_network_speed_bytes",
151+
"node_network_transmit_queue_length",
152+
"node_network_up",
153+
},
154+
},
129155
}
130156

131157
for _, test := range tests {

0 commit comments

Comments
 (0)