From 90e36c337a3af9db918fffd5f99f3b178dbeeed1 Mon Sep 17 00:00:00 2001 From: Adrian Haas Date: Thu, 28 Mar 2024 09:20:23 +0100 Subject: [PATCH 1/3] Expire silences after one day instead of one year --- component/scripts/silence.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/component/scripts/silence.sh b/component/scripts/silence.sh index 08186cb9..923ec5e7 100644 --- a/component/scripts/silence.sh +++ b/component/scripts/silence.sh @@ -9,7 +9,7 @@ while IFS= read -r silence; do body=$(printf %s "$silence" | \ jq \ --arg startsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '-1 min')" \ - --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 year')" \ + --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 day')" \ --arg createdBy "Kubernetes object \`cronjob/silence\` in the monitoring namespace" \ '.startsAt = $startsAt | .endsAt = $endsAt | .createdBy = $createdBy' ) From 239f6f23ee4b639b6f7f022e745dda45b99132a1 Mon Sep 17 00:00:00 2001 From: Adrian Haas Date: Thu, 28 Mar 2024 09:21:58 +0100 Subject: [PATCH 2/3] Update silence duration in docs --- docs/modules/ROOT/pages/references/parameters.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/modules/ROOT/pages/references/parameters.adoc b/docs/modules/ROOT/pages/references/parameters.adoc index 67853308..897192cb 100644 --- a/docs/modules/ROOT/pages/references/parameters.adoc +++ b/docs/modules/ROOT/pages/references/parameters.adoc @@ -534,7 +534,7 @@ default:: Contains the list of silences to be applied. The key is used as the comment of the silence and the value is a dictionary which is passed to Alertmanager. -Silences removed from the hierarchy stay active in Alertmanager for up to a year until they expire. +Silences removed from the hierarchy stay active in Alertmanager for up to 24h until they expire. Silences all non-SYN alerts by default. From b70457cb4cae6ce92281ee0a52b40c524b583ba6 Mon Sep 17 00:00:00 2001 From: Adrian Haas Date: Thu, 28 Mar 2024 09:56:50 +0100 Subject: [PATCH 3/3] Update golden tests --- .../openshift4-monitoring/openshift4-monitoring/silence.yaml | 2 +- .../openshift4-monitoring/openshift4-monitoring/silence.yaml | 2 +- .../openshift4-monitoring/openshift4-monitoring/silence.yaml | 2 +- .../openshift4-monitoring/openshift4-monitoring/silence.yaml | 2 +- .../openshift4-monitoring/openshift4-monitoring/silence.yaml | 2 +- .../openshift4-monitoring/openshift4-monitoring/silence.yaml | 2 +- .../openshift4-monitoring/openshift4-monitoring/silence.yaml | 2 +- .../openshift4-monitoring/openshift4-monitoring/silence.yaml | 2 +- .../openshift4-monitoring/openshift4-monitoring/silence.yaml | 2 +- .../openshift4-monitoring/openshift4-monitoring/silence.yaml | 2 +- .../openshift4-monitoring/openshift4-monitoring/silence.yaml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/golden/capacity-alerts-with-node-labels/openshift4-monitoring/openshift4-monitoring/silence.yaml b/tests/golden/capacity-alerts-with-node-labels/openshift4-monitoring/openshift4-monitoring/silence.yaml index 8bd05aaf..c3e45f77 100644 --- a/tests/golden/capacity-alerts-with-node-labels/openshift4-monitoring/openshift4-monitoring/silence.yaml +++ b/tests/golden/capacity-alerts-with-node-labels/openshift4-monitoring/openshift4-monitoring/silence.yaml @@ -12,7 +12,7 @@ data: body=$(printf %s "$silence" | \ jq \ --arg startsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '-1 min')" \ - --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 year')" \ + --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 day')" \ --arg createdBy "Kubernetes object \`cronjob/silence\` in the monitoring namespace" \ '.startsAt = $startsAt | .endsAt = $endsAt | .createdBy = $createdBy' ) diff --git a/tests/golden/capacity-alerts/openshift4-monitoring/openshift4-monitoring/silence.yaml b/tests/golden/capacity-alerts/openshift4-monitoring/openshift4-monitoring/silence.yaml index 8bd05aaf..c3e45f77 100644 --- a/tests/golden/capacity-alerts/openshift4-monitoring/openshift4-monitoring/silence.yaml +++ b/tests/golden/capacity-alerts/openshift4-monitoring/openshift4-monitoring/silence.yaml @@ -12,7 +12,7 @@ data: body=$(printf %s "$silence" | \ jq \ --arg startsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '-1 min')" \ - --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 year')" \ + --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 day')" \ --arg createdBy "Kubernetes object \`cronjob/silence\` in the monitoring namespace" \ '.startsAt = $startsAt | .endsAt = $endsAt | .createdBy = $createdBy' ) diff --git a/tests/golden/custom-rules/openshift4-monitoring/openshift4-monitoring/silence.yaml b/tests/golden/custom-rules/openshift4-monitoring/openshift4-monitoring/silence.yaml index 8bd05aaf..c3e45f77 100644 --- a/tests/golden/custom-rules/openshift4-monitoring/openshift4-monitoring/silence.yaml +++ b/tests/golden/custom-rules/openshift4-monitoring/openshift4-monitoring/silence.yaml @@ -12,7 +12,7 @@ data: body=$(printf %s "$silence" | \ jq \ --arg startsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '-1 min')" \ - --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 year')" \ + --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 day')" \ --arg createdBy "Kubernetes object \`cronjob/silence\` in the monitoring namespace" \ '.startsAt = $startsAt | .endsAt = $endsAt | .createdBy = $createdBy' ) diff --git a/tests/golden/release-4.11/openshift4-monitoring/openshift4-monitoring/silence.yaml b/tests/golden/release-4.11/openshift4-monitoring/openshift4-monitoring/silence.yaml index 8bd05aaf..c3e45f77 100644 --- a/tests/golden/release-4.11/openshift4-monitoring/openshift4-monitoring/silence.yaml +++ b/tests/golden/release-4.11/openshift4-monitoring/openshift4-monitoring/silence.yaml @@ -12,7 +12,7 @@ data: body=$(printf %s "$silence" | \ jq \ --arg startsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '-1 min')" \ - --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 year')" \ + --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 day')" \ --arg createdBy "Kubernetes object \`cronjob/silence\` in the monitoring namespace" \ '.startsAt = $startsAt | .endsAt = $endsAt | .createdBy = $createdBy' ) diff --git a/tests/golden/release-4.12/openshift4-monitoring/openshift4-monitoring/silence.yaml b/tests/golden/release-4.12/openshift4-monitoring/openshift4-monitoring/silence.yaml index 8bd05aaf..c3e45f77 100644 --- a/tests/golden/release-4.12/openshift4-monitoring/openshift4-monitoring/silence.yaml +++ b/tests/golden/release-4.12/openshift4-monitoring/openshift4-monitoring/silence.yaml @@ -12,7 +12,7 @@ data: body=$(printf %s "$silence" | \ jq \ --arg startsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '-1 min')" \ - --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 year')" \ + --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 day')" \ --arg createdBy "Kubernetes object \`cronjob/silence\` in the monitoring namespace" \ '.startsAt = $startsAt | .endsAt = $endsAt | .createdBy = $createdBy' ) diff --git a/tests/golden/release-4.13/openshift4-monitoring/openshift4-monitoring/silence.yaml b/tests/golden/release-4.13/openshift4-monitoring/openshift4-monitoring/silence.yaml index 8bd05aaf..c3e45f77 100644 --- a/tests/golden/release-4.13/openshift4-monitoring/openshift4-monitoring/silence.yaml +++ b/tests/golden/release-4.13/openshift4-monitoring/openshift4-monitoring/silence.yaml @@ -12,7 +12,7 @@ data: body=$(printf %s "$silence" | \ jq \ --arg startsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '-1 min')" \ - --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 year')" \ + --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 day')" \ --arg createdBy "Kubernetes object \`cronjob/silence\` in the monitoring namespace" \ '.startsAt = $startsAt | .endsAt = $endsAt | .createdBy = $createdBy' ) diff --git a/tests/golden/release-4.14/openshift4-monitoring/openshift4-monitoring/silence.yaml b/tests/golden/release-4.14/openshift4-monitoring/openshift4-monitoring/silence.yaml index 8bd05aaf..c3e45f77 100644 --- a/tests/golden/release-4.14/openshift4-monitoring/openshift4-monitoring/silence.yaml +++ b/tests/golden/release-4.14/openshift4-monitoring/openshift4-monitoring/silence.yaml @@ -12,7 +12,7 @@ data: body=$(printf %s "$silence" | \ jq \ --arg startsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '-1 min')" \ - --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 year')" \ + --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 day')" \ --arg createdBy "Kubernetes object \`cronjob/silence\` in the monitoring namespace" \ '.startsAt = $startsAt | .endsAt = $endsAt | .createdBy = $createdBy' ) diff --git a/tests/golden/remote-write/openshift4-monitoring/openshift4-monitoring/silence.yaml b/tests/golden/remote-write/openshift4-monitoring/openshift4-monitoring/silence.yaml index 8bd05aaf..c3e45f77 100644 --- a/tests/golden/remote-write/openshift4-monitoring/openshift4-monitoring/silence.yaml +++ b/tests/golden/remote-write/openshift4-monitoring/openshift4-monitoring/silence.yaml @@ -12,7 +12,7 @@ data: body=$(printf %s "$silence" | \ jq \ --arg startsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '-1 min')" \ - --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 year')" \ + --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 day')" \ --arg createdBy "Kubernetes object \`cronjob/silence\` in the monitoring namespace" \ '.startsAt = $startsAt | .endsAt = $endsAt | .createdBy = $createdBy' ) diff --git a/tests/golden/team-routing/openshift4-monitoring/openshift4-monitoring/silence.yaml b/tests/golden/team-routing/openshift4-monitoring/openshift4-monitoring/silence.yaml index 8bd05aaf..c3e45f77 100644 --- a/tests/golden/team-routing/openshift4-monitoring/openshift4-monitoring/silence.yaml +++ b/tests/golden/team-routing/openshift4-monitoring/openshift4-monitoring/silence.yaml @@ -12,7 +12,7 @@ data: body=$(printf %s "$silence" | \ jq \ --arg startsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '-1 min')" \ - --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 year')" \ + --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 day')" \ --arg createdBy "Kubernetes object \`cronjob/silence\` in the monitoring namespace" \ '.startsAt = $startsAt | .endsAt = $endsAt | .createdBy = $createdBy' ) diff --git a/tests/golden/user-workload-monitoring/openshift4-monitoring/openshift4-monitoring/silence.yaml b/tests/golden/user-workload-monitoring/openshift4-monitoring/openshift4-monitoring/silence.yaml index 8bd05aaf..c3e45f77 100644 --- a/tests/golden/user-workload-monitoring/openshift4-monitoring/openshift4-monitoring/silence.yaml +++ b/tests/golden/user-workload-monitoring/openshift4-monitoring/openshift4-monitoring/silence.yaml @@ -12,7 +12,7 @@ data: body=$(printf %s "$silence" | \ jq \ --arg startsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '-1 min')" \ - --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 year')" \ + --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 day')" \ --arg createdBy "Kubernetes object \`cronjob/silence\` in the monitoring namespace" \ '.startsAt = $startsAt | .endsAt = $endsAt | .createdBy = $createdBy' ) diff --git a/tests/golden/vsphere/openshift4-monitoring/openshift4-monitoring/silence.yaml b/tests/golden/vsphere/openshift4-monitoring/openshift4-monitoring/silence.yaml index 8bd05aaf..c3e45f77 100644 --- a/tests/golden/vsphere/openshift4-monitoring/openshift4-monitoring/silence.yaml +++ b/tests/golden/vsphere/openshift4-monitoring/openshift4-monitoring/silence.yaml @@ -12,7 +12,7 @@ data: body=$(printf %s "$silence" | \ jq \ --arg startsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '-1 min')" \ - --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 year')" \ + --arg endsAt "$(date -u +'%Y-%m-%dT%H:%M:%S' --date '+1 day')" \ --arg createdBy "Kubernetes object \`cronjob/silence\` in the monitoring namespace" \ '.startsAt = $startsAt | .endsAt = $endsAt | .createdBy = $createdBy' )