Skip to content

Commit c72ac03

Browse files
authored
Merge pull request #885 from jkroepke/missing-cluster-label
Storage Alerts: Missing cluster label
2 parents 2dbe4f9 + 6212c1e commit c72ac03

File tree

3 files changed

+279
-250
lines changed

3 files changed

+279
-250
lines changed

alerts/storage_alerts.libsonnet

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@
2626
) < 0.03
2727
and
2828
kubelet_volume_stats_used_bytes{%(prefixedNamespaceSelector)s%(kubeletSelector)s} > 0
29-
unless on(namespace, persistentvolumeclaim)
29+
unless on(%(clusterLabel)s, namespace, persistentvolumeclaim)
3030
kube_persistentvolumeclaim_access_mode{%(prefixedNamespaceSelector)s access_mode="ReadOnlyMany"} == 1
31-
unless on(namespace, persistentvolumeclaim)
31+
unless on(%(clusterLabel)s, namespace, persistentvolumeclaim)
3232
kube_persistentvolumeclaim_labels{%(prefixedNamespaceSelector)s%(pvExcludedSelector)s} == 1
3333
||| % $._config,
3434
'for': '1m',
3535
labels: {
3636
severity: 'critical',
3737
},
3838
annotations: {
39-
description: 'The PersistentVolume claimed by {{ $labels.persistentvolumeclaim }} in Namespace {{ $labels.namespace }} is only {{ $value | humanizePercentage }} free.',
39+
description: 'The PersistentVolume claimed by {{ $labels.persistentvolumeclaim }} in Namespace {{ $labels.namespace }} on Cluster {{ $labels.%(clusterLabel)s }} is only {{ $value | humanizePercentage }} free.' % $._config,
4040
summary: 'PersistentVolume is filling up.',
4141
},
4242
},
@@ -52,17 +52,17 @@
5252
kubelet_volume_stats_used_bytes{%(prefixedNamespaceSelector)s%(kubeletSelector)s} > 0
5353
and
5454
predict_linear(kubelet_volume_stats_available_bytes{%(prefixedNamespaceSelector)s%(kubeletSelector)s}[%(volumeFullPredictionSampleTime)s], 4 * 24 * 3600) < 0
55-
unless on(namespace, persistentvolumeclaim)
55+
unless on(%(clusterLabel)s, namespace, persistentvolumeclaim)
5656
kube_persistentvolumeclaim_access_mode{%(prefixedNamespaceSelector)s access_mode="ReadOnlyMany"} == 1
57-
unless on(namespace, persistentvolumeclaim)
57+
unless on(%(clusterLabel)s, namespace, persistentvolumeclaim)
5858
kube_persistentvolumeclaim_labels{%(prefixedNamespaceSelector)s%(pvExcludedSelector)s} == 1
5959
||| % $._config,
6060
'for': '1h',
6161
labels: {
6262
severity: 'warning',
6363
},
6464
annotations: {
65-
description: 'Based on recent sampling, the PersistentVolume claimed by {{ $labels.persistentvolumeclaim }} in Namespace {{ $labels.namespace }} is expected to fill up within four days. Currently {{ $value | humanizePercentage }} is available.',
65+
description: 'Based on recent sampling, the PersistentVolume claimed by {{ $labels.persistentvolumeclaim }} in Namespace {{ $labels.namespace }} on Cluster {{ $labels.%(clusterLabel)s }} is expected to fill up within four days. Currently {{ $value | humanizePercentage }} is available.' % $._config,
6666
summary: 'PersistentVolume is filling up.',
6767
},
6868
},
@@ -76,17 +76,17 @@
7676
) < 0.03
7777
and
7878
kubelet_volume_stats_inodes_used{%(prefixedNamespaceSelector)s%(kubeletSelector)s} > 0
79-
unless on(namespace, persistentvolumeclaim)
79+
unless on(%(clusterLabel)s, namespace, persistentvolumeclaim)
8080
kube_persistentvolumeclaim_access_mode{%(prefixedNamespaceSelector)s access_mode="ReadOnlyMany"} == 1
81-
unless on(namespace, persistentvolumeclaim)
81+
unless on(%(clusterLabel)s, namespace, persistentvolumeclaim)
8282
kube_persistentvolumeclaim_labels{%(prefixedNamespaceSelector)s%(pvExcludedSelector)s} == 1
8383
||| % $._config,
8484
'for': '1m',
8585
labels: {
8686
severity: 'critical',
8787
},
8888
annotations: {
89-
description: 'The PersistentVolume claimed by {{ $labels.persistentvolumeclaim }} in Namespace {{ $labels.namespace }} only has {{ $value | humanizePercentage }} free inodes.',
89+
description: 'The PersistentVolume claimed by {{ $labels.persistentvolumeclaim }} in Namespace {{ $labels.namespace }} on Cluster {{ $labels.%(clusterLabel)s }} only has {{ $value | humanizePercentage }} free inodes.' % $._config,
9090
summary: 'PersistentVolumeInodes are filling up.',
9191
},
9292
},
@@ -102,17 +102,17 @@
102102
kubelet_volume_stats_inodes_used{%(prefixedNamespaceSelector)s%(kubeletSelector)s} > 0
103103
and
104104
predict_linear(kubelet_volume_stats_inodes_free{%(prefixedNamespaceSelector)s%(kubeletSelector)s}[%(volumeFullPredictionSampleTime)s], 4 * 24 * 3600) < 0
105-
unless on(namespace, persistentvolumeclaim)
105+
unless on(%(clusterLabel)s, namespace, persistentvolumeclaim)
106106
kube_persistentvolumeclaim_access_mode{%(prefixedNamespaceSelector)s access_mode="ReadOnlyMany"} == 1
107-
unless on(namespace, persistentvolumeclaim)
107+
unless on(%(clusterLabel)s, namespace, persistentvolumeclaim)
108108
kube_persistentvolumeclaim_labels{%(prefixedNamespaceSelector)s%(pvExcludedSelector)s} == 1
109109
||| % $._config,
110110
'for': '1h',
111111
labels: {
112112
severity: 'warning',
113113
},
114114
annotations: {
115-
description: 'Based on recent sampling, the PersistentVolume claimed by {{ $labels.persistentvolumeclaim }} in Namespace {{ $labels.namespace }} is expected to run out of inodes within four days. Currently {{ $value | humanizePercentage }} of its inodes are free.',
115+
description: 'Based on recent sampling, the PersistentVolume claimed by {{ $labels.persistentvolumeclaim }} in Namespace {{ $labels.namespace }} on Cluster {{ $labels.%(clusterLabel)s }} is expected to run out of inodes within four days. Currently {{ $value | humanizePercentage }} of its inodes are free.' % $._config,
116116
summary: 'PersistentVolumeInodes are filling up.',
117117
},
118118
},
@@ -126,7 +126,7 @@
126126
severity: 'critical',
127127
},
128128
annotations: {
129-
description: 'The persistent volume {{ $labels.persistentvolume }} has status {{ $labels.phase }}.',
129+
description: 'The persistent volume {{ $labels.persistentvolume }} on Cluster {{ $labels.%(clusterLabel)s }} has status {{ $labels.phase }}.' % $._config,
130130
summary: 'PersistentVolume is having issues with provisioning.',
131131
},
132132
},

rules/node.libsonnet

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
expr: |||
3333
count by (%(clusterLabel)s, node) (
3434
node_cpu_seconds_total{mode="idle",%(nodeExporterSelector)s}
35-
* on (namespace, %(podLabel)s) group_left(node)
36-
topk by(namespace, %(podLabel)s) (1, node_namespace_pod:kube_pod_info:)
35+
* on (%(clusterLabel)s, namespace, %(podLabel)s) group_left(node)
36+
topk by(%(clusterLabel)s, namespace, %(podLabel)s) (1, node_namespace_pod:kube_pod_info:)
3737
)
3838
||| % $._config,
3939
},

0 commit comments

Comments
 (0)