Skip to content

Commit 1613a4d

Browse files
committed
add nodeExporter.collectors.netclass settings.
1 parent 6a52edd commit 1613a4d

File tree

10 files changed

+106
-0
lines changed

10 files changed

+106
-0
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- [#1882](https://github.com/openshift/cluster-monitoring-operator/issues/1882) Allow configuring secrets in alertmanager component (platform)
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.
13+
- [#1893](https://github.com/openshift/cluster-monitoring-operator/pull/1893) Add nodeExporter.collectors.netclass settings.
1314

1415

1516
## 4.12

Diff for: 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)
@@ -192,6 +193,7 @@ The `NodeExporterCollectorConfig` resource defines settings for individual colle
192193
| cpufreq | [NodeExporterCollectorCpufreqConfig](#nodeexportercollectorcpufreqconfig) | Defines the configuration of the `cpufreq` collector, which collects CPU frequency statistics. Disabled by default. |
193194
| tcpstat | [NodeExporterCollectorTcpStatConfig](#nodeexportercollectortcpstatconfig) | Defines the configuration of the `tcpstat` collector, which collects TCP connection statistics. Disabled by default. |
194195
| netdev | [NodeExporterCollectorNetDevConfig](#nodeexportercollectornetdevconfig) | Defines the configuration of the `netdev` collector, which collects network devices statistics. Enabled by default. |
196+
| netclass | [NodeExporterCollectorNetClassConfig](#nodeexportercollectornetclassconfig) | Defines the configuration of the `netclass` collector, which collects network devices information. Enabled by default. |
195197

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

@@ -210,6 +212,21 @@ The `NodeExporterCollectorCpufreqConfig` resource works as an on/off switch for
210212

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

215+
## NodeExporterCollectorNetClassConfig
216+
217+
#### Description
218+
219+
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`.
220+
221+
222+
<em>appears in: [NodeExporterCollectorConfig](#nodeexportercollectorconfig)</em>
223+
224+
| Property | Type | Description |
225+
| -------- | ---- | ----------- |
226+
| enabled | bool | A Boolean flag that enables or disables the `netclass` collector. |
227+
228+
[Back to TOC](#table-of-contents)
229+
213230
## NodeExporterCollectorNetDevConfig
214231

215232
#### Description

Diff for: 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]

Diff for: 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 network devices information. 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]

Diff for: 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
}

Diff for: pkg/manifests/manifests.go

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

825+
if f.config.ClusterMonitoringConfiguration.NodeExporterConfig.Collectors.NetClass.Enabled {
826+
args = setArg(args, "--collector.netclass", "")
827+
} else {
828+
args = setArg(args, "--no-collector.netclass", "")
829+
}
830+
825831
return args
826832
}
827833

Diff for: pkg/manifests/manifests_test.go

+13
Original file line numberDiff line numberDiff line change
@@ -2837,10 +2837,12 @@ func TestNodeExporterCollectorSettings(t *testing.T) {
28372837
argsPresent: []string{"--no-collector.cpufreq",
28382838
"--no-collector.tcpstat",
28392839
"--collector.netdev",
2840+
"--collector.netclass",
28402841
},
28412842
argsAbsent: []string{"--collector.cpufreq",
28422843
"--collector.tcpstat",
28432844
"--no-collector.netdev",
2845+
"--no-collector.netclass",
28442846
},
28452847
},
28462848
{
@@ -2876,6 +2878,17 @@ nodeExporter:
28762878
argsPresent: []string{"--no-collector.netdev"},
28772879
argsAbsent: []string{"--collector.netdev"},
28782880
},
2881+
{
2882+
name: "disable netclass collector",
2883+
config: `
2884+
nodeExporter:
2885+
collectors:
2886+
netclass:
2887+
enabled: false
2888+
`,
2889+
argsPresent: []string{"--no-collector.netclass"},
2890+
argsAbsent: []string{"--collector.netclass"},
2891+
},
28792892
}
28802893

28812894
for _, test := range tests {

Diff for: 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 network devices information.
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

Diff for: test/e2e/node_exporter_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@ 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+
},
129137
}
130138

131139
for _, test := range tests {

0 commit comments

Comments
 (0)