REST HTTP can get info / pause specific alert but can t use global pause-all-alerts

Hi guys

REF used: Admin HTTP API | Grafana documentation and Alerting HTTP API | Grafana documentation
grafana vers 4.1.2 on linux docker

So: http API request seems to work for some feature but not for others.
I can
. get config (GET /api/admin/settings)

  • get alert details (GET /api/alerts/)
  • pause an alert (POST /api/alerts/:id/pause)
    ex: working
    curl --http1.1 -H “Content-type: application/json” -H “Authorization: Bearer myapiauthentification” -X GET http://l4docker1701:3000/api/alerts/8

But can NOT:

  • pause all alert (
    DELETE /api/admin/pause-all-alerts)
    curl --http1.1 -H “Content-type: application/json” -H “Authorization: Bearer myapiauthentification” -X DELETE http://l4docker1701:3000/api/admin/pause-all-alerts
    => {“message”:“Not found”}

Can someone please help me ?

hi

i think i found it. It is an error in the documentation

I have looked into source code and found this
r.Post("/pause-all-alerts", bind(dtos.PauseAllAlertsCommand{}), wrap(PauseAllAlerts))
so it is a POST command !!!

But in the doc it is written:
Pause all alerts
DELETE /api/admin/pause-all-alerts
So the Doc is wrong

Please correct this in http://docs.grafana.org/http_api/admin/

TY !

1 Like

Thank you for reporting this! The documentation will be updated in a few minutes. It had both the wrong verb and the JSON body was undocumented. Here is a curl command using basic auth:

curl -X POST http://admin:adminpassword@localhost:3000/api/admin/pause-all-alerts -H "Content-Type: application/json" -d '{"paused": true}'

@daniellee @eridur142

Can I use the pause-all-alerts for specific hosts only? If I have 3 hosts monitored on Grafana client-01, client-02 & client-03;

I want to be able to use api to silence/pause alerts for client-01 only.
Is this currently possible ?