Skip to content

Commit

Permalink
MON-3113: add nodeExporter.collectors.mountstats settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
raptorsun committed Apr 6, 2023
1 parent 7b0a677 commit 12eae25
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Documentation/api.md
Expand Up @@ -28,6 +28,7 @@ Configuring Cluster Monitoring is optional. If the config does not exist or is e
* [NodeExporterCollectorBuddyInfoConfig](#nodeexportercollectorbuddyinfoconfig)
* [NodeExporterCollectorConfig](#nodeexportercollectorconfig)
* [NodeExporterCollectorCpufreqConfig](#nodeexportercollectorcpufreqconfig)
* [NodeExporterCollectorMountStatsConfig](#nodeexportercollectormountstatsconfig)
* [NodeExporterCollectorNetClassConfig](#nodeexportercollectornetclassconfig)
* [NodeExporterCollectorNetDevConfig](#nodeexportercollectornetdevconfig)
* [NodeExporterCollectorTcpStatConfig](#nodeexportercollectortcpstatconfig)
Expand Down Expand Up @@ -212,6 +213,7 @@ The `NodeExporterCollectorConfig` resource defines settings for individual colle
| netdev | [NodeExporterCollectorNetDevConfig](#nodeexportercollectornetdevconfig) | Defines the configuration of the `netdev` collector, which collects network devices statistics. Enabled by default. |
| netclass | [NodeExporterCollectorNetClassConfig](#nodeexportercollectornetclassconfig) | Defines the configuration of the `netclass` collector, which collects information about network devices. Enabled by default. |
| buddyinfo | [NodeExporterCollectorBuddyInfoConfig](#nodeexportercollectorbuddyinfoconfig) | Defines the configuration of the `buddyinfo` collector, which collects statistics about memory fragmentation from the `node_buddyinfo_blocks` metric. This metric collects data from `/proc/buddyinfo`. Disabled by default. |
| mountstats | [NodeExporterCollectorMountStatsConfig](#nodeexportercollectormountstatsconfig) | Defines the configuration of the `mountstats` collector, which collects statistics about NFS volume IO activities. Disabled by default. |

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

Expand All @@ -230,6 +232,21 @@ The `NodeExporterCollectorCpufreqConfig` resource works as an on/off switch for

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

## NodeExporterCollectorMountStatsConfig

#### Description

The `NodeExporterCollectorMountStatsConfig` resource works as an on/off switch for the `mountstats` collector of the `node-exporter` agent. By default, the `mountstats` collector is disabled. If enabled, these metrics become available:\n\n\t`node_mountstats_nfs_read_bytes_total`,\n\t`node_mountstats_nfs_write_bytes_total`,\n\t`node_mountstats_nfs_operations_requests_total`.\n\nPlease be aware that these metric can have a high cardinality. If you enable this collector, watch the prometheus-k8s deployment closely for excessive memory usage.


<em>appears in: [NodeExporterCollectorConfig](#nodeexportercollectorconfig)</em>

| Property | Type | Description |
| -------- | ---- | ----------- |
| enabled | bool | A Boolean flag that enables or disables the `mountstats` collector. |

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

## NodeExporterCollectorNetClassConfig

#### Description
Expand Down
1 change: 1 addition & 0 deletions Documentation/openshiftdocs/index.adoc
Expand Up @@ -48,6 +48,7 @@ The configuration file itself is always defined under the `config.yaml` key in t
* link:modules/nodeexportercollectorbuddyinfoconfig.adoc[NodeExporterCollectorBuddyInfoConfig]
* link:modules/nodeexportercollectorconfig.adoc[NodeExporterCollectorConfig]
* link:modules/nodeexportercollectorcpufreqconfig.adoc[NodeExporterCollectorCpufreqConfig]
* link:modules/nodeexportercollectormountstatsconfig.adoc[NodeExporterCollectorMountStatsConfig]
* link:modules/nodeexportercollectornetclassconfig.adoc[NodeExporterCollectorNetClassConfig]
* link:modules/nodeexportercollectornetdevconfig.adoc[NodeExporterCollectorNetDevConfig]
* link:modules/nodeexportercollectortcpstatconfig.adoc[NodeExporterCollectorTcpStatConfig]
Expand Down
Expand Up @@ -28,6 +28,8 @@ Appears in: link:nodeexporterconfig.adoc[NodeExporterConfig]

|buddyinfo|link:nodeexportercollectorbuddyinfoconfig.adoc[NodeExporterCollectorBuddyInfoConfig]|Defines the configuration of the `buddyinfo` collector, which collects statistics about memory fragmentation from the `node_buddyinfo_blocks` metric. This metric collects data from `/proc/buddyinfo`. Disabled by default.

|mountstats|link:nodeexportercollectormountstatsconfig.adoc[NodeExporterCollectorMountStatsConfig]|Defines the configuration of the `mountstats` collector, which collects statistics about NFS volume IO activities. Disabled by default.

|===

link:../index.adoc[Back to TOC]
@@ -0,0 +1,25 @@
// DO NOT EDIT THE CONTENT IN THIS FILE. It is automatically generated from the
// source code for the Cluster Monitoring Operator. Any changes made to this
// file will be overwritten when the content is re-generated. If you wish to
// make edits, read the docgen utility instructions in the source code for the
// CMO.
:_content-type: ASSEMBLY

== NodeExporterCollectorMountStatsConfig

=== Description

The `NodeExporterCollectorMountStatsConfig` resource works as an on/off switch for the `mountstats` collector of the `node-exporter` agent. By default, the `mountstats` collector is disabled. If enabled, these metrics become available:\n\n\t`node_mountstats_nfs_read_bytes_total`,\n\t`node_mountstats_nfs_write_bytes_total`,\n\t`node_mountstats_nfs_operations_requests_total`.\n\nPlease be aware that these metric can have a high cardinality. If you enable this collector, watch the prometheus-k8s deployment closely for excessive memory usage.



Appears in: link:nodeexportercollectorconfig.adoc[NodeExporterCollectorConfig]

[options="header"]
|===
| Property | Type | Description
|enabled|bool|A Boolean flag that enables or disables the `mountstats` collector.

|===

link:../index.adoc[Back to TOC]
6 changes: 6 additions & 0 deletions pkg/manifests/manifests.go
Expand Up @@ -857,6 +857,12 @@ func (f *Factory) updateNodeExporterArgs(args []string) []string {
args = setArg(args, "--no-collector.buddyinfo", "")
}

if f.config.ClusterMonitoringConfiguration.NodeExporterConfig.Collectors.MountStats.Enabled {
args = setArg(args, "--collector.mountstats", "")
} else {
args = setArg(args, "--no-collector.mountstats", "")
}

return args
}

Expand Down
11 changes: 11 additions & 0 deletions pkg/manifests/manifests_test.go
Expand Up @@ -2993,6 +2993,17 @@ nodeExporter:
argsPresent: []string{"--collector.buddyinfo"},
argsAbsent: []string{"--no-collector.buddyinfo"},
},
{
name: "enable mountstats collector",
config: `
nodeExporter:
collectors:
mountstats:
enabled: true
`,
argsPresent: []string{"--collector.mountstats"},
argsAbsent: []string{"--no-collector.mountstats"},
},
}

for _, test := range tests {
Expand Down
19 changes: 19 additions & 0 deletions pkg/manifests/types.go
Expand Up @@ -297,6 +297,9 @@ type NodeExporterCollectorConfig struct {
// Defines the configuration of the `buddyinfo` collector, which collects statistics about memory fragmentation from the `node_buddyinfo_blocks` metric. This metric collects data from `/proc/buddyinfo`.
// Disabled by default.
BuddyInfo NodeExporterCollectorBuddyInfoConfig `json:"buddyinfo,omitempty"`
// Defines the configuration of the `mountstats` collector, which collects statistics about NFS volume IO activities.
// Disabled by default.
MountStats NodeExporterCollectorMountStatsConfig `json:"mountstats,omitempty"`
}

// The `NodeExporterCollectorCpufreqConfig` resource works as an on/off switch for
Expand Down Expand Up @@ -388,6 +391,22 @@ type NodeExporterCollectorBuddyInfoConfig struct {
Enabled bool `json:"enabled,omitempty"`
}

// The `NodeExporterCollectorMountStatsConfig` resource works as an on/off switch for
// the `mountstats` collector of the `node-exporter` agent.
// By default, the `mountstats` collector is disabled.
// If enabled, these metrics become available:
//
// `node_mountstats_nfs_read_bytes_total`,
// `node_mountstats_nfs_write_bytes_total`,
// `node_mountstats_nfs_operations_requests_total`.
//
// Please be aware that these metric can have a high cardinality.
// If you enable this collector, watch the prometheus-k8s deployment closely for excessive memory usage.
type NodeExporterCollectorMountStatsConfig struct {
// A Boolean flag that enables or disables the `mountstats` collector.
Enabled bool `json:"enabled,omitempty"`
}

// The `UserWorkloadConfiguration` resource defines the settings
// responsible for user-defined projects in the
// `user-workload-monitoring-config` config map in the
Expand Down
8 changes: 8 additions & 0 deletions test/e2e/node_exporter_test.go
Expand Up @@ -60,6 +60,14 @@ nodeExporter:
nodeExporter:
collectors:
buddyinfo:
enabled: true`,
},
{
nameCollector: "mountstats",
config: `
nodeExporter:
collectors:
mountstats:
enabled: true`,
},
}
Expand Down

0 comments on commit 12eae25

Please sign in to comment.