From b128dcae61cbd46854408b50d525aa848dd48fc1 Mon Sep 17 00:00:00 2001 From: Malik Kennedy Date: Mon, 12 Aug 2024 17:14:10 -0400 Subject: [PATCH] bugfix: allow specifying which collectors to exclude --- jsonnet/kube-prometheus/components/node-exporter.libsonnet | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/jsonnet/kube-prometheus/components/node-exporter.libsonnet b/jsonnet/kube-prometheus/components/node-exporter.libsonnet index 21aa9e2859..9f2fee9d2e 100644 --- a/jsonnet/kube-prometheus/components/node-exporter.libsonnet +++ b/jsonnet/kube-prometheus/components/node-exporter.libsonnet @@ -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'], // NOTE: ignore veth network interface associated with containers. // OVN renames veth.* to @if where X is /sys/class/net//ifindex // thus [a-z0-9] regex below @@ -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 },