Answers: <p>With alertmanager 0.22 (perhaps even earlier?) the solution using regex is a bit less obvious as there is no longer any checkbox to tick for using a regex.</p>
  <p>Instead, you must use <code>Name=&quot;Value&quot;</code> for an equality check and <code>Name=~&quot;RegEx.*&quot;</code> if you want to use a regular expression. So you must use the <code>=~</code> operator.</p>
  
Answers: CC BY-SA 4.0
Answers: 2021-10-18T16:39:04.320Z
Answers: 2021-10-18T16:39:04.320Z
Answers: wjentner
Answers: <p>What about Name = &quot;prometheus&quot;, Value = &quot;.*&quot;. That is something that worked for me. <a href="https://i.sstatic.net/81ksC.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/81ksC.png" alt="enter image description here" /></a></p>
  <p>An alternative can be Name = &quot;severity&quot;, Value = &quot;.*&quot; also.</p>
  
Answers: CC BY-SA 4.0
Answers: 2020-06-23T07:47:29.000Z
Answers: thank you, your answer made me realize I didn't test key alertname with value .*, which works as well as the options you have covered, thanks a lot. It looks like request with any key is not acceptable to the api.
Answers: anVzdGFub3RoZXJodW1hbg
Answers: CC BY-SA 4.0
Answers: 2020-06-22T21:33:18.887Z
Answers: 2020-06-22T21:33:18.887Z
Answers: Mikhail Advani
Answers: <p>If it's the only selector alertmanager (0.24) doesn't allow it to match an empty string.</p>
  <p>So use prometheus=~&quot;.+&quot; or severity=~&quot;.+&quot; instead of prometheus=~&quot;.*&quot;, otherwise you get the error &quot;silence invalid: at least one matcher must not match the empty string&quot; from alertmanager.</p>
  
Answers: CC BY-SA 4.0
Answers: 2023-04-07T03:56:21.730Z
Answers: In 2023 I am using severity=~".+" based on this answer.
Answers: anVzdGFub3RoZXJodW1hbg
Answers: CC BY-SA 4.0
Answers: 2024-11-25T14:55:15.300Z
Answers: I can confirm this works BUT it also suppresses the always-firing Watchdog alert. In our case, this had the external StatusCake monitoring which monitors AlertManager itself think there's an incident.
  Instead, I ended up using `alertname!=Watchdog`
Answers: insideClaw
Answers: CC BY-SA 4.0
Answers: 2022-09-05T09:37:28.957Z
Answers: 2022-09-05T09:37:28.957Z
Answers: pa7ac
Body: <p>A work scenario that I can't cover currently is that I want to set a maintenance mode, meaning all alerts received from Prometheus to be ignored, I want to be able to set it through the UI for a given period until maintenance finish. One way to do it is manually to start covering each alert which in Prometheus-operator scenario is not sane, or I would lose a couple of hours. I can change config from secret to route all to null, but that is not practical as it requires multiple actions and is not good for on time or other user usage.
  So I tried to use regex for key and value. Both set to .* .* regex. On preview I get all alerts covered, but when I click Create I get &quot;Bad Request&quot;? I couldn't find examples in internet and on official page which surprised me quite a lot.
  <a href="https://i.sstatic.net/C4yuz.png" rel="noreferrer"><img src="https://i.sstatic.net/C4yuz.png" alt="enter image description here" /></a></p>
  
Tags: <prometheus><sre>
Title: Prometheus Alertamanger - how to silence all alerts for a given period during a maintenance?
UserDisplayName: anVzdGFub3RoZXJodW1hbg
ThreadText: # Prometheus Alertamanger - how to silence all alerts for a given period during a maintenance?
  
  (Asked by: username_0 on 2020-06-22)
  
  A work scenario that I can't cover currently is that I want to set a maintenance mode, meaning all alerts received from Prometheus to be ignored, I want to be able to set it through the UI for a given period until maintenance finish. One way to do it is manually to start covering each alert which in Prometheus-operator scenario is not sane, or I would lose a couple of hours. I can change config from secret to route all to null, but that is not practical as it requires multiple actions and is not good for on time or other user usage.
  So I tried to use regex for key and value. Both set to .\* .\* regex. On preview I get all alerts covered, but when I click Create I get "Bad Request"? I couldn't find examples in internet and on official page which surprised me quite a lot.
  [![enter image description here](https://i.sstatic.net/C4yuz.png)](https://i.sstatic.net/C4yuz.png)
  
  **Tags:** prometheus, sre
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_3 on 2022-09-05. Score: 7 | Accepted answer
  
  If it's the only selector alertmanager (0.24) doesn't allow it to match an empty string.
  
  So use prometheus=~".+" or severity=~".+" instead of prometheus=~".\*", otherwise you get the error "silence invalid: at least one matcher must not match the empty string" from alertmanager.
  
  > **Comments:**
  > **username_0**: In 2023 I am using severity=~".+" based on this answer.  
  > **username_4**: I can confirm this works BUT it also suppresses the always-firing Watchdog alert. In our case, this had the external StatusCake monitoring which monitors AlertManager itself think there's an incident. Instead, I ended up using `alertname!=Watchdog`  
  
  ---
  
  ### Answer by username_1 on 2021-10-18. Score: 6
  
  With alertmanager 0.22 (perhaps even earlier?) the solution using regex is a bit less obvious as there is no longer any checkbox to tick for using a regex.
  
  Instead, you must use `Name="Value"` for an equality check and `Name=~"RegEx.*"` if you want to use a regular expression. So you must use the `=~` operator.
  
  
  ---
  
  ### Answer by username_2 on 2020-06-22. Score: 4
  
  What about Name = "prometheus", Value = ".\*". That is something that worked for me. [![enter image description here](https://i.sstatic.net/81ksC.png)](https://i.sstatic.net/81ksC.png)
  
  An alternative can be Name = "severity", Value = ".\*" also.
  
  > **Comments:**
  > **username_0**: thank you, your answer made me realize I didn't test key alertname with value .*, which works as well as the options you have covered, thanks a lot. It looks like request with any key is not acceptable to the api.  
  
  ---
  
  