Using API to silence all alerts with the new Grafana alerting

I recently switched to the new alering method within Grafana 8.3.3
I used to silence all my alerts with a api call on set times in the week because of server updates to not have false positives.
Now with the new alerting the API does not seem to work.
If i call to silence all alerts for the next 3 hiours i see no silence rule being added in the silence dashboard.
Is there a new API or different API?

  • What Grafana version and what operating system are you using?
    RHEL8 with Grafana8.3.3
  • What are you trying to achieve?
    Pause all alerts with API call
  • How are you trying to achieve it?
    Calling the API from bash in crontab
  • What happened?
    Nothing
  • What did you expect to happen?
    Pausing of all alerts (like before the switch to the new grafana alerting)
  • Can you copy/paste the configuration(s) that you are having problems with?
    n/a
  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    n/a
  • Did you follow any online instructions? If so, what is the URL?
    n/a

Here is the new API specification for Grafana 8 Unified Alerting:

https://editor.swagger.io/?url=https://raw.githubusercontent.com/grafana/grafana/main/pkg/services/ngalert/api/tooling/post.json

I’m a little bit of a noob perhaps but i don’t really see a replacement API i can do for my API:

curl -f --location --request POST ‘https://myserver:3000/api/admin/pause-all-alerts
–header ‘Content-Type: application/json’
–header ‘Accept: application/json’
–header 'Authorization: Basic ’
–data-raw ‘{
“paused”: ‘${1}’
}’

Were you able to find a way to silence all alerts globally?

My latest call goes like this:

APIResp=$(curl --location --request POST ‘https://myserver:3000/api/alertmanager/grafana/api/v2/silences
–header ‘Content-Type: application/json’
–header ‘Authorization: Basic something’
–data-raw ‘{
“comment”: “prod_env Silence by API without id”,
“createdBy”: “someuser”,
“endsAt”: "’$endSilence’",
“matchers”: [
{
“isEqual”: true,
“isRegex”: false,
“name”: “env”,
“value”: “prod”
}
],
“startsAt”: “’$startSilence’”
}’)

That’s going to silence only env=prod, right? I was trying to silence everything.

If you have a common field you can use that.
I don’t know if there is a big pause button like before.