Skip to content

Commit

Permalink
Merge pull request #322 from appuio/simplify-silencing
Browse files Browse the repository at this point in the history
Use amtool in the alertmanager pod instead of silencing job
  • Loading branch information
haasad authored Apr 15, 2024
2 parents 30db6c6 + c97a6b9 commit 93affe1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@

IMPORTANT: Make sure that your `$KUBECONFIG` points to the cluster you want to migrate before starting.

:duration: +120 minutes
include::partial$create-alertmanager-silence-all-projectsyn.adoc[]
:alert_statement: alertname!=Watchdog
:duration: 3h
:comment: cilium migration
include::partial$create-amtool-silence.adoc[]

. Select cluster
+
Expand Down Expand Up @@ -268,4 +270,4 @@ include::partial$enable-argocd-autosync.adoc[]

== Cleanup alert silence

include::partial$remove-alertmanager-silence-all-projectsyn.adoc[]
include::partial$expire-amtool-silence.adoc[]
12 changes: 12 additions & 0 deletions docs/modules/ROOT/partials/create-amtool-silence.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// see https://manpages.debian.org/unstable/prometheus-alertmanager/amtool.1.en.html#silence_add_%5B%3Cflags%3E%5D_%5B%3Cmatcher-groups%3E...%5D
. Create alertmanager silence
+
[source,bash,subs="attributes+"]
----
silence_id=$(
kubectl --as=cluster-admin -n openshift-monitoring exec \
sts/alertmanager-main -- amtool --alertmanager.url=http://localhost:9093 \
silence add {alert_statement} --duration="{duration}" -c "{comment}"
)
echo $silence_id
----
8 changes: 8 additions & 0 deletions docs/modules/ROOT/partials/expire-amtool-silence.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// see https://manpages.debian.org/unstable/prometheus-alertmanager/amtool.1.en.html#silence_expire_%5B%3Csilence-ids%3E...%5D
. Expire alertmanager silence
+
[source,bash]
----
kubectl --as=cluster-admin -n openshift-monitoring exec sts/alertmanager-main --\
amtool --alertmanager.url=http://localhost:9093 silence expire $silence_id
----

0 comments on commit 93affe1

Please sign in to comment.