Skip to content

Commit 554c065

Browse files
authored
Allow excluding mount points using jsonnet. (#977)
* Allow excluding mount points using jsonnet. This will allow overriding the mount point exclusions. A similar mechanism already exists for filesystems. Signed-off-by: Milan Plzik <[email protected]> * jsonnetfmt Signed-off-by: Milan Plzik <[email protected]> * Add a function to override the 'excluded_mount_points'. Signed-off-by: Milan Plzik <[email protected]> --------- Signed-off-by: Milan Plzik <[email protected]>
1 parent 48309ec commit 554c065

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

node-exporter/main.libsonnet

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ local k = import 'github.com/grafana/jsonnet-libs/ksonnet-util/kausal.libsonnet'
2828
'tracefs',
2929
],
3030

31+
excluded_mount_points:: '^/(rootfs/)?(dev|proc|sys|var/lib/docker/.+)($|/)',
32+
3133
local container = k.core.v1.container,
3234
container::
3335
container.new('node-exporter', image)
@@ -41,7 +43,7 @@ local k = import 'github.com/grafana/jsonnet-libs/ksonnet-util/kausal.libsonnet'
4143
// Reduces cardinality by ignoring a few devices, fs-types and mount-points.
4244
'--collector.netdev.device-exclude=^veth.+$',
4345
'--collector.filesystem.fs-types-exclude=^(%s)$' % std.join('|', self.ignored_fs_types),
44-
'--collector.filesystem.mount-points-exclude=^/(rootfs/)?(dev|proc|sys|var/lib/docker/.+)($|/)',
46+
'--collector.filesystem.mount-points-exclude=%s' % self.excluded_mount_points,
4547
])
4648
+ container.mixin.securityContext.withPrivileged(true)
4749
+ container.mixin.securityContext.withRunAsUser(0)
@@ -64,5 +66,9 @@ local k = import 'github.com/grafana/jsonnet-libs/ksonnet-util/kausal.libsonnet'
6466
daemonset+: k.util.hostVolumeMount('root', '/', '/rootfs'),
6567
},
6668

69+
withExcludedMountPoints(mps):: {
70+
excluded_mount_points:: mps,
71+
},
72+
6773
scrape_config: (import './scrape_config.libsonnet'),
6874
}

0 commit comments

Comments
 (0)