Re: [prometheus-users] Alertmanager Silence API - how to expire an alert through API

107 views
Skip to first unread message

Augustin Husson

unread,
Jul 9, 2020, 3:47:46 AM7/9/20
to Velmurugan C, Prometheus Users
You can do it like that :

curl -XDELETE http://alertmanager/api/v2/silence/<SilenceId>

Le jeu. 9 juil. 2020 à 07:27, Velmurugan C <cvel...@gmail.com> a écrit :
Dear All,

I have created the silence in my alertmanager through CURL command with below details

curl http://<alertManager>:9093/api/v1/silences -d '{
      "matchers": [
        {
          "name": "<NAME>",
          "value": "<VALUE>",
          "isRegex": true
        }
      ],
      "startsAt": "'"$startTime"'",
      "endsAt": "'"$endTime"'",
      "createdBy": "api",
      "comment": "Silence",
      "status": {
        "state": "expired"
      }

}'


Any idea about how we can expire an active alert?

Note: I expect  way to do this without amtool


Thanks......

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/8ed9f7b9-4eef-4ef0-a789-95addc3c26c0o%40googlegroups.com.

Velmurugan C

unread,
Jul 9, 2020, 8:01:37 AM7/9/20
to Prometheus Users
Thanks Augustin... 

Can't we do this using matchers(Ex. alertname, application stack name) instead of using SilenceID ?


Thanks....



On Thursday, July 9, 2020 at 1:17:46 PM UTC+5:30, Augustin Husson wrote:
You can do it like that :

curl -XDELETE http://alertmanager/api/v2/silence/<SilenceId>

Le jeu. 9 juil. 2020 à 07:27, Velmurugan C <cvel...@gmail.com> a écrit :
Dear All,

I have created the silence in my alertmanager through CURL command with below details

curl http://<alertManager>:9093/api/v1/silences -d '{
      "matchers": [
        {
          "name": "<NAME>",
          "value": "<VALUE>",
          "isRegex": true
        }
      ],
      "startsAt": "'"$startTime"'",
      "endsAt": "'"$endTime"'",
      "createdBy": "api",
      "comment": "Silence",
      "status": {
        "state": "expired"
      }

}'


Any idea about how we can expire an active alert?

Note: I expect  way to do this without amtool


Thanks......

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to promethe...@googlegroups.com.

Augustin Husson

unread,
Jul 9, 2020, 9:35:42 AM7/9/20
to Velmurugan C, Prometheus Users
So far from my knowledge that's not possible. But you have the ID in the response returned when you are creating the silence.

To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/69c68552-bc13-4a8f-beb3-1c0fd005fbe0o%40googlegroups.com.

Velmurugan C

unread,
Jul 10, 2020, 9:12:46 AM7/10/20
to Prometheus Users
Thanks.. I'm trying to get the silenceID using the CURL, I could get the response in json format.

Any idea about how we can filter the ID alone with some conditions?

in below response I want to get the ID with matchers->value  & status->state  as the conditions

Response:

{
  "status": "success",
  "data": [
    {
      "id": "9c566ac5-cc81-4f13-bebb-4c237ca7488d",
      "matchers": [
        {
          "name": "stack",
          "value": "QA-stack",
          "isRegex": true
        }
      ],
      "startsAt": "2020-07-08T11:47:35Z",
      "endsAt": "2020-07-10T11:45:40Z",
      "updatedAt": "2020-07-08T11:46:00.638919938Z",
      "createdBy": "api",
      "comment": "Silence",
      "status": {
        "state": "active"
      }
    },
    {
      "id": "6e7f7205-b28e-4063-adeb-b037933fd8ca",
      "matchers": [
        {
          "name": "stack",
          "value": "DEV-STACK",
          "isRegex": true
        }
      ],
      "startsAt": "2020-07-07T11:43:50.853902669Z",
      "endsAt": "2020-07-08T13:43:09.824Z",
      "updatedAt": "2020-07-07T11:43:50.853902669Z",
      "createdBy": "api",
      "comment": "Silence",
      "status": {
        "state": "active"
      }
        }
  ]
}








Reply all
Reply to author
Forward
0 new messages