Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use amtool in the alertmanager pod instead of silencing job #322

Merged
merged 2 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
----