5.21.3 Get silence list of Alertmanager
- Description
-
Gets the list of silences created in Alertmanager in JSON format.
- Format
-
- Request line
GET /api/v2/silences HTTP/1.1
- Request header
-
Header name
Setup values
Host
Specifies value of the header for Alertmanager host to which API is connected, in the following format:
Host name or IP address:Port number
":Port number" is optional.
-
Host name or IP address
Specifies host name or IPv4 address of Alertmanager.
-
Port number
Specifies port number to use when connecting to Alertmanager.
This header is not optional.
-
- Request message body
-
None
- Response message body
[ { "id": "Silence ID", "status": { "state": "status" }, "updatedAt": "Updated", "comment": "comment", "createdBy": "Author Name", "endsAt": "End date and time", "matchers": [ { "isRegex":regular expression flag, "name": "label name", "value": "value" }, ... ], "startsAt": "Start date and time" }, ... ]
- Response parameters
-
Member name
Data type
Description
id
string
Sets an ID that is uniquely assigned to the silence configuration. Used to run the Silence Revocation API.
Alertmanager configures it automatically.
status
object
An object that represents the silence state.
Alertmanager configures it automatically.
state
string
One of the following values is set:
-
active
The silence setting is enabled.
-
pending
The application start date and time has not passed.
-
expired
The application end date and time has passed.
Alertmanager configures it automatically.
updatedAt
string
The creation or modification date and time of the silence configuration is set in the ISO8601 extended format.
Alertmanager configures it automatically.
matchers
object
Conditions are set to suppress the issuance of alerts. Suppresses the issuance of alerts that match the label name and label value specified by name and value.
name
string
The label name is set.
value
string
The value of the label is set.
isRegex
boolean
Sets whether the value of value is specified by regular expression.
-
true
It is specified by a regular expression.
-
false
Not specified in a regular expression.
isEqual
boolean
Set whether to suppress alert notifications when matchers are met.
Always set to "true" (suppress alert notifications).
Alertmanager configures it automatically.
startsAt
string
The date and time when silence is applied is set in the ISO8601 extended format. The date and time will be the time zone specified in the "Create Silence" API.
endsAt
string
The silence end date and time is set in the ISO8601 extended format. The date and time will be the time zone specified in the "Create Silence" API.
createdBy
string
Sets the author name of the silence configuration.
comment
string
The comment for the silence settings is set.
-
- Status codes
-
Status code
Message
Description
200
OK
The list of silences was successfully obtained.
Other than 200
Other than OK
Failed to get silence list.
- Examples
-
The following is an example of using this API using the OSS curl command. In the example below, line breaks and indents have been added for clarity. There are no line breaks or indentation in the actual output. Also, the output order of JSON properties is undefined.
>curl --request GET "http://localhost:20714/api/v2/silences" [ { "id": "787594fd-29a6-495d-921a-d37709f6186e", "status": { "state": "pending" }, "updatedAt": "2021-08-07T02:02:56.206Z", "comment": "cpu alert silence", "createdBy": "api", "endsAt": "2021-08-15T05:00:00.000Z", "matchers": [ { "isEqual": true, "isRegex": false, "name": "alertname", "value": "cpu alert" } ], "startsAt": "2021-08-15T04:00:00.000Z" } ] >