From 609000993f11622224390c2f304c39263712f9c9 Mon Sep 17 00:00:00 2001 From: Robert Nemeti Date: Fri, 31 Aug 2018 14:23:40 +0200 Subject: [PATCH 1/4] add alert for Pending or Failed PersistentVolumes --- alerts/storage_alerts.libsonnet | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/alerts/storage_alerts.libsonnet b/alerts/storage_alerts.libsonnet index 967f5573a..5caa7d7b2 100644 --- a/alerts/storage_alerts.libsonnet +++ b/alerts/storage_alerts.libsonnet @@ -39,6 +39,19 @@ message: 'Based on recent sampling, the PersistentVolume claimed by {{ $labels.persistentvolumeclaim }} in Namespace {{ $labels.namespace }} is expected to fill up within four days. Currently {{ printf "%0.2f" $value }}% is available.', }, }, + { + alert: 'KubePersistentVolumeErrors', + expr: ||| + kube_persistentvolume_status_phase{phase=~"Failed|Pending"} > 0 + ||| + 'for': '1m', + labels: { + severity: 'critical', + }, + annotations: { + message: 'The persistent volume {{ $labels.persistentvolume }} has status {{ $labels.phase }}.', + }, + }, ], }, ], From abe5dc66f668f1c886cf05200a663410c397418d Mon Sep 17 00:00:00 2001 From: Robert Nemeti Date: Mon, 3 Sep 2018 08:55:19 +0200 Subject: [PATCH 2/4] fix syntax error --- alerts/storage_alerts.libsonnet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alerts/storage_alerts.libsonnet b/alerts/storage_alerts.libsonnet index 5caa7d7b2..8661ce0ae 100644 --- a/alerts/storage_alerts.libsonnet +++ b/alerts/storage_alerts.libsonnet @@ -43,7 +43,7 @@ alert: 'KubePersistentVolumeErrors', expr: ||| kube_persistentvolume_status_phase{phase=~"Failed|Pending"} > 0 - ||| + |||, 'for': '1m', labels: { severity: 'critical', From 7df786588bd31ada51c4178c60eeb0b2c5d872fc Mon Sep 17 00:00:00 2001 From: Robert Nemeti Date: Thu, 8 Nov 2018 09:17:24 +0100 Subject: [PATCH 3/4] increase alert wait time --- alerts/storage_alerts.libsonnet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alerts/storage_alerts.libsonnet b/alerts/storage_alerts.libsonnet index 8661ce0ae..175c77b3e 100644 --- a/alerts/storage_alerts.libsonnet +++ b/alerts/storage_alerts.libsonnet @@ -44,7 +44,7 @@ expr: ||| kube_persistentvolume_status_phase{phase=~"Failed|Pending"} > 0 |||, - 'for': '1m', + 'for': '5m', labels: { severity: 'critical', }, From 7049c79785e2b740df67846b5e6d65df42a0a009 Mon Sep 17 00:00:00 2001 From: Robert Nemeti Date: Thu, 8 Nov 2018 14:08:53 +0100 Subject: [PATCH 4/4] include selection labels --- alerts/storage_alerts.libsonnet | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/alerts/storage_alerts.libsonnet b/alerts/storage_alerts.libsonnet index 175c77b3e..ba23ce5b2 100644 --- a/alerts/storage_alerts.libsonnet +++ b/alerts/storage_alerts.libsonnet @@ -42,8 +42,8 @@ { alert: 'KubePersistentVolumeErrors', expr: ||| - kube_persistentvolume_status_phase{phase=~"Failed|Pending"} > 0 - |||, + kube_persistentvolume_status_phase{phase=~"Failed|Pending",%(prefixedNamespaceSelector)s%(kubeStateMetricsSelector)s} > 0 + ||| % $._config, 'for': '5m', labels: { severity: 'critical',