首页 > 解决方案 > Prometheus Alertmanger 使用 curl 删除所有静音。REST API

问题描述

如何使用 curl 删除 Prometheus Alertmanger 中所有现有的静音。

我尝试使用它但得到404 page not found

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

我怎样才能删除所有的沉默?就像是

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

标签: prometheusprometheus-alertmanager

解决方案


您不能仅使用 curl 命令删除所有静音,但您可以使用以下命令列出所有静音 ID:

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

然后使用“curl -X DELETE”命令删除。


推荐阅读