Search code examples
prometheusprometheus-alertmanager

Prometheus Alertmanger delete All silences using curl. REST API


How can I delete all the existing silences in Prometheus Alertmanger using the curl.

I tried using this but getting 404 page not found

curl -X DELETE http://alerts.example.org:9093/api/v1/silence/<silenceId>

How can I delete all the silences? something like

curl -X DELETE http://alerts.example.org:9093/api/v1/silence/*


Solution

  • You can't delete all the silences with just a curl command but you can list all the silences ids with the following command:

    curl -X GET http://alerts.example.org:9093/api/v1/silences | jq --raw-output '.data[].id'
    
    9e2d7680-8543-447f-9776-db513fa88b3b
    1e37bb70-a6ae-4247-b748-fd7aee838140
    6dac91c5-08a7-4a14-8dac-7137c61ae94d
    

    And then delete using your "curl -X DELETE" command.