docs/node-mixin: add fsMointpointSelector to alerts and dashboards (#2446)

* docs/node-mixin: add fsMountpointSelector

This adds the option to add a `mountpoint` selector to filesystem
related alerts. The default is `mountpoint!=""`.

* docs/node-mixins: add fsMountpointSelector to dashboards

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
This commit is contained in:
Jan Fajerski 2022-10-20 13:06:31 +02:00 committed by GitHub
parent 385cb1922c
commit 87b8e3790d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 27 deletions

View file

@ -8,11 +8,11 @@
alert: 'NodeFilesystemSpaceFillingUp', alert: 'NodeFilesystemSpaceFillingUp',
expr: ||| expr: |||
( (
node_filesystem_avail_bytes{%(nodeExporterSelector)s,%(fsSelector)s} / node_filesystem_size_bytes{%(nodeExporterSelector)s,%(fsSelector)s} * 100 < %(fsSpaceFillingUpWarningThreshold)d node_filesystem_avail_bytes{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} / node_filesystem_size_bytes{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} * 100 < %(fsSpaceFillingUpWarningThreshold)d
and and
predict_linear(node_filesystem_avail_bytes{%(nodeExporterSelector)s,%(fsSelector)s}[6h], 24*60*60) < 0 predict_linear(node_filesystem_avail_bytes{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s}[6h], 24*60*60) < 0
and and
node_filesystem_readonly{%(nodeExporterSelector)s,%(fsSelector)s} == 0 node_filesystem_readonly{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} == 0
) )
||| % $._config, ||| % $._config,
'for': '1h', 'for': '1h',
@ -28,11 +28,11 @@
alert: 'NodeFilesystemSpaceFillingUp', alert: 'NodeFilesystemSpaceFillingUp',
expr: ||| expr: |||
( (
node_filesystem_avail_bytes{%(nodeExporterSelector)s,%(fsSelector)s} / node_filesystem_size_bytes{%(nodeExporterSelector)s,%(fsSelector)s} * 100 < %(fsSpaceFillingUpCriticalThreshold)d node_filesystem_avail_bytes{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} / node_filesystem_size_bytes{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} * 100 < %(fsSpaceFillingUpCriticalThreshold)d
and and
predict_linear(node_filesystem_avail_bytes{%(nodeExporterSelector)s,%(fsSelector)s}[6h], 4*60*60) < 0 predict_linear(node_filesystem_avail_bytes{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s}[6h], 4*60*60) < 0
and and
node_filesystem_readonly{%(nodeExporterSelector)s,%(fsSelector)s} == 0 node_filesystem_readonly{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} == 0
) )
||| % $._config, ||| % $._config,
'for': '1h', 'for': '1h',
@ -48,9 +48,9 @@
alert: 'NodeFilesystemAlmostOutOfSpace', alert: 'NodeFilesystemAlmostOutOfSpace',
expr: ||| expr: |||
( (
node_filesystem_avail_bytes{%(nodeExporterSelector)s,%(fsSelector)s} / node_filesystem_size_bytes{%(nodeExporterSelector)s,%(fsSelector)s} * 100 < %(fsSpaceAvailableWarningThreshold)d node_filesystem_avail_bytes{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} / node_filesystem_size_bytes{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} * 100 < %(fsSpaceAvailableWarningThreshold)d
and and
node_filesystem_readonly{%(nodeExporterSelector)s,%(fsSelector)s} == 0 node_filesystem_readonly{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} == 0
) )
||| % $._config, ||| % $._config,
'for': '30m', 'for': '30m',
@ -66,9 +66,9 @@
alert: 'NodeFilesystemAlmostOutOfSpace', alert: 'NodeFilesystemAlmostOutOfSpace',
expr: ||| expr: |||
( (
node_filesystem_avail_bytes{%(nodeExporterSelector)s,%(fsSelector)s} / node_filesystem_size_bytes{%(nodeExporterSelector)s,%(fsSelector)s} * 100 < %(fsSpaceAvailableCriticalThreshold)d node_filesystem_avail_bytes{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} / node_filesystem_size_bytes{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} * 100 < %(fsSpaceAvailableCriticalThreshold)d
and and
node_filesystem_readonly{%(nodeExporterSelector)s,%(fsSelector)s} == 0 node_filesystem_readonly{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} == 0
) )
||| % $._config, ||| % $._config,
'for': '30m', 'for': '30m',
@ -84,11 +84,11 @@
alert: 'NodeFilesystemFilesFillingUp', alert: 'NodeFilesystemFilesFillingUp',
expr: ||| expr: |||
( (
node_filesystem_files_free{%(nodeExporterSelector)s,%(fsSelector)s} / node_filesystem_files{%(nodeExporterSelector)s,%(fsSelector)s} * 100 < 40 node_filesystem_files_free{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} / node_filesystem_files{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} * 100 < 40
and and
predict_linear(node_filesystem_files_free{%(nodeExporterSelector)s,%(fsSelector)s}[6h], 24*60*60) < 0 predict_linear(node_filesystem_files_free{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s}[6h], 24*60*60) < 0
and and
node_filesystem_readonly{%(nodeExporterSelector)s,%(fsSelector)s} == 0 node_filesystem_readonly{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} == 0
) )
||| % $._config, ||| % $._config,
'for': '1h', 'for': '1h',
@ -104,11 +104,11 @@
alert: 'NodeFilesystemFilesFillingUp', alert: 'NodeFilesystemFilesFillingUp',
expr: ||| expr: |||
( (
node_filesystem_files_free{%(nodeExporterSelector)s,%(fsSelector)s} / node_filesystem_files{%(nodeExporterSelector)s,%(fsSelector)s} * 100 < 20 node_filesystem_files_free{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} / node_filesystem_files{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} * 100 < 20
and and
predict_linear(node_filesystem_files_free{%(nodeExporterSelector)s,%(fsSelector)s}[6h], 4*60*60) < 0 predict_linear(node_filesystem_files_free{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s}[6h], 4*60*60) < 0
and and
node_filesystem_readonly{%(nodeExporterSelector)s,%(fsSelector)s} == 0 node_filesystem_readonly{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} == 0
) )
||| % $._config, ||| % $._config,
'for': '1h', 'for': '1h',
@ -124,9 +124,9 @@
alert: 'NodeFilesystemAlmostOutOfFiles', alert: 'NodeFilesystemAlmostOutOfFiles',
expr: ||| expr: |||
( (
node_filesystem_files_free{%(nodeExporterSelector)s,%(fsSelector)s} / node_filesystem_files{%(nodeExporterSelector)s,%(fsSelector)s} * 100 < 5 node_filesystem_files_free{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} / node_filesystem_files{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} * 100 < 5
and and
node_filesystem_readonly{%(nodeExporterSelector)s,%(fsSelector)s} == 0 node_filesystem_readonly{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} == 0
) )
||| % $._config, ||| % $._config,
'for': '1h', 'for': '1h',
@ -142,9 +142,9 @@
alert: 'NodeFilesystemAlmostOutOfFiles', alert: 'NodeFilesystemAlmostOutOfFiles',
expr: ||| expr: |||
( (
node_filesystem_files_free{%(nodeExporterSelector)s,%(fsSelector)s} / node_filesystem_files{%(nodeExporterSelector)s,%(fsSelector)s} * 100 < 3 node_filesystem_files_free{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} / node_filesystem_files{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} * 100 < 3
and and
node_filesystem_readonly{%(nodeExporterSelector)s,%(fsSelector)s} == 0 node_filesystem_readonly{%(nodeExporterSelector)s,%(fsSelector)s,%(fsMountpointSelector)s} == 0
) )
||| % $._config, ||| % $._config,
'for': '1h', 'for': '1h',

View file

@ -16,6 +16,14 @@
// alerting, you can exclude them here, e.g. 'fstype!="tmpfs"'. // alerting, you can exclude them here, e.g. 'fstype!="tmpfs"'.
fsSelector: 'fstype!=""', fsSelector: 'fstype!=""',
// Select the mountpoint for filesystem-related queries. If left
// empty, all mountpoints are selected. For example if you have a
// special purpose tmpfs instance that has a fixed size and will
// always be 100% full, but you still want alerts and dashboards for
// other tmpfs instances, you can exclude those by mountpoint prefix
// like so: 'mountpoint!~"/var/lib/foo.*"'.
fsMountpointSelector: 'mountpoint!=""',
// Select the device for disk-related queries. If left empty, all // Select the device for disk-related queries. If left empty, all
// devices are selected. If you have unusual devices you don't // devices are selected. If you have unusual devices you don't
// want to include in dashboards and alerting, you can exclude // want to include in dashboards and alerting, you can exclude

View file

@ -307,12 +307,12 @@ local diskSpaceUtilisation =
||| |||
sum without (device) ( sum without (device) (
max without (fstype, mountpoint) (( max without (fstype, mountpoint) ((
node_filesystem_size_bytes{%(nodeExporterSelector)s, %(fsSelector)s, %(clusterLabel)s="$cluster"} node_filesystem_size_bytes{%(nodeExporterSelector)s, %(fsSelector)s, %(fsMountpointSelector)s, %(clusterLabel)s="$cluster"}
- -
node_filesystem_avail_bytes{%(nodeExporterSelector)s, %(fsSelector)s, %(clusterLabel)s="$cluster"} node_filesystem_avail_bytes{%(nodeExporterSelector)s, %(fsSelector)s, %(fsMountpointSelector)s, %(clusterLabel)s="$cluster"}
) != 0) ) != 0)
) )
/ scalar(sum(max without (fstype, mountpoint) (node_filesystem_size_bytes{%(nodeExporterSelector)s, %(fsSelector)s, %(clusterLabel)s="$cluster"}))) / scalar(sum(max without (fstype, mountpoint) (node_filesystem_size_bytes{%(nodeExporterSelector)s, %(fsSelector)s, %(fsMountpointSelector)s, %(clusterLabel)s="$cluster"})))
||| % $._config, legendFormat='{{instance}}' ||| % $._config, legendFormat='{{instance}}'
)) ))
) )
@ -453,10 +453,10 @@ local diskSpaceUtilisation =
sum ( sum (
sum without (device) ( sum without (device) (
max without (fstype, mountpoint, instance, pod) (( max without (fstype, mountpoint, instance, pod) ((
node_filesystem_size_bytes{%(nodeExporterSelector)s, %(fsSelector)s} - node_filesystem_avail_bytes{%(nodeExporterSelector)s, %(fsSelector)s} node_filesystem_size_bytes{%(nodeExporterSelector)s, %(fsSelector)s, %(fsMountpointSelector)s) - node_filesystem_avail_bytes{%(nodeExporterSelector)s, %(fsSelector)s, %(fsMountpointSelector)s}
) != 0) ) != 0)
) )
/ scalar(sum(max without (fstype, mountpoint) (node_filesystem_size_bytes{%(nodeExporterSelector)s, %(fsSelector)s}))) / scalar(sum(max without (fstype, mountpoint) (node_filesystem_size_bytes{%(nodeExporterSelector)s, %(fsSelector)s, %(fsMountpointSelector)s})))
) by (%(clusterLabel)s) ) by (%(clusterLabel)s)
||| % $._config, legendFormat='{{%(clusterLabel)s}}' % $._config ||| % $._config, legendFormat='{{%(clusterLabel)s}}' % $._config
)) ))

View file

@ -232,7 +232,7 @@ local table = grafana70.panel.table;
.addThresholdStep(color='red', value=0.9) .addThresholdStep(color='red', value=0.9)
.addTarget(prometheus.target( .addTarget(prometheus.target(
||| |||
max by (mountpoint) (node_filesystem_size_bytes{%(nodeExporterSelector)s, instance="$instance", %(fsSelector)s}) max by (mountpoint) (node_filesystem_size_bytes{%(nodeExporterSelector)s, instance="$instance", %(fsSelector)s, %(fsMountpointSelector)s})
||| % config, ||| % config,
legendFormat='', legendFormat='',
instant=true, instant=true,
@ -240,7 +240,7 @@ local table = grafana70.panel.table;
)) ))
.addTarget(prometheus.target( .addTarget(prometheus.target(
||| |||
max by (mountpoint) (node_filesystem_avail_bytes{%(nodeExporterSelector)s, instance="$instance", %(fsSelector)s}) max by (mountpoint) (node_filesystem_avail_bytes{%(nodeExporterSelector)s, instance="$instance", %(fsSelector)s, %(fsMountpointSelector)s})
||| % config, ||| % config,
legendFormat='', legendFormat='',
instant=true, instant=true,