Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying which node exporter collectors to exclude #2485

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 2 additions & 4 deletions jsonnet/kube-prometheus/components/node-exporter.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ local defaults = {
},
listenAddress:: '127.0.0.1',
filesystemMountPointsExclude:: '^/(dev|proc|sys|run/k3s/containerd/.+|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/)',
exportersExclude:: ['wifi', 'btrfs', 'hwmon'],
Copy link
Contributor

Choose a reason for hiding this comment

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

IIUC by default we should not exclude these, you can have the exclude variable and while importing this jsonnet you should define the variable to include collectors to exclude so that default setting doesn't change

Copy link
Author

Choose a reason for hiding this comment

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

They were already excluded, I just exposed them as a variable.

// NOTE: ignore veth network interface associated with containers.
// OVN renames veth.* to <rand-hex>@if<X> where X is /sys/class/net/<if>/ifindex
// thus [a-z0-9] regex below
Expand Down Expand Up @@ -214,13 +215,10 @@ function(params) {
'--path.sysfs=/host/sys',
'--path.rootfs=/host/root',
'--path.udev.data=/host/root/run/udev/data',
'--no-collector.wifi',
'--no-collector.hwmon',
'--no-collector.btrfs',
'--collector.filesystem.mount-points-exclude=' + ne._config.filesystemMountPointsExclude,
'--collector.netclass.ignored-devices=' + ne._config.ignoredNetworkDevices,
'--collector.netdev.device-exclude=' + ne._config.ignoredNetworkDevices,
],
] + std.map (function (x) std.format ( '--no-collector.%s', x), ne._config.exportersExclude),
volumeMounts: [
{ name: 'sys', mountPath: '/host/sys', mountPropagation: 'HostToContainer', readOnly: true },
{ name: 'root', mountPath: '/host/root', mountPropagation: 'HostToContainer', readOnly: true },
Expand Down