OpenShift - Expire Alert Manager Silence using amtool
by
Jeremy Canfield |
Updated: January 19 2024
| OpenShift articles
If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.
In the openshift-monitoring namespace, there should be one or more alertmanager pods.
~]$ oc get pods --namespace openshift-monitoring
NAME READY STATUS RESTARTS AGE
alertmanager-main-0 6/6 Running 0 6d10h
alertmanager-main-1 6/6 Running 1 (6d10h ago) 6d10h
The oc exec command can be used to run the amtool CLI in one of the alertmanager pods.
Let's say you issued the amtool silence add command to silence an alarm.
oc exec pod/alertmanager-main-0 --namespace openshift-monitoring -- amtool silence add 'alertname=FluentdNodeDown' --alertmanager.url="http://localhost:9093" --duration="1d" --comment="temporarily silencing this alert for 1 day"
And the the amtool silence command can be used to list the silenced alerts.
~]$ oc exec pod/alertmanager-main-0 --namespace openshift-monitoring -- amtool silence --alertmanager.url="http://localhost:9093"
ID Matchers Ends At Created By Comment
d86e8aa8-91f3-463d-a34a-daf530682f38 alertname="FluentdNodeDown" 2024-01-20 09:29:29 UTC john.doe temporarily silencing this alert for 1 day
The amtool silence expire command can be used the expire the silence. In this example, the ID of the silence is used.
oc exec pod/alertmanager-main-0 --namespace openshift-monitoring -- amtool silence --alertmanager.url=http://localhost:9093 expire d86e8aa8-91f3-463d-a34a-daf530682f38
Did you find this article helpful?
If so, consider buying me a coffee over at