Hitachi

JP1 Version 13 JP1/Integrated Management 3 - Manager Command, Definition File and API Reference


5.21.4 Silence creation of Alertmanager

Description

Pass the JSON format silence settings as arguments and create a silence in Alertmanager.

The silence ID returned as a response is an identifier uniquely assigned to the silence setting. Used to run Alertmanager's silence revocation API.

When you set silence, Alertmanager automatically adds the following:

  • id

  • status

  • status.state

  • updatedAt

  • matchers.isEqual

Format
Request line
POST /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.

Content-Type

Specify the format of the request headers as follows:

Content-Type: application/json

This header is optional.

Request message body
{
    "matchers": [
        {
            "name": "label name",
            "value": "value",
            "isRegex": Regular expression flags
        },
        ...
    ],
    "startsAt": "Start date and time",
    "endsAt": "End date and time",
    "createdBy": "Author Name",
    "comment": "comment",
}
Request parameters

Member name

Data type

Description

matchers

object

An object that specifies the conditions under which alerts are suppressed.

Suppresses the issuance of alerts that match the label name and label value specified by name and value.

name

string

Specify a label name.

You can specify the following values for the label name:

  • Metric label name

  • Label name (e.g. jp1_pc_eventid) set under labels in the alert configuration file (jpc_alerting_rules.yml)

  • "alertname" label#

Note #

To suppress the issuance of alerts based on the alert name, specify "alertname" in the name member and the alert name in the value member.

Only single-byte alphanumeric characters can be specified.

You cannot specify an empty string.

value

string

Specify a value for the label.

You cannot specify an empty string.

isRegex

boolean

Specifies whether the value of value is specified as a regular expression.

  • true

    It is specified by a regular expression.

  • false

    Not specified in a regular expression.

startsAt

string

Specify the date and time when silence can be applied (ISO8601 extended format).

You can specify a time zone for the date and time.

(Designated example)2022-02-08T19:00:00+09:00

endsAt

string

Specify the date and time when silence is applied (ISO8601 extended format).

If you specify a date and time earlier than startAt or an expired date and time (a date and time earlier than the current time), silence creation fails.

You can specify a time zone for the date and time.

(Designated example)2022-02-08T21:00:00+09:00

createdBy

string

Specifies the author name.

comment

string

Specify a comment.

Response message body
{
"silenceID":"silenceID"
}
Status codes

Status code

Message

Description

200

OK

Silence was successfully created.

Other than 200

Other than OK

Silence creation failed.

Examples

The following is an example of using this API using the OSS curl command.

> curl --header "Content-Type: application/json" --request POST --data @C:\tmp\silence.json "http://localhost:20714/api/v2/silences"
{"silenceID":"9ae46d02-4db8-4098-a8e4-f9181d66611c"}
>

silence.json:

{
    "matchers": [
        {
            "name": "alertname",
            "value": "cpu idel alert",
            "isRegex": false
        }
    ],
    "startsAt": "2021-08-09T19:00:00+09:00",
    "endsAt": "2021-08-09T21:00:00+09:00",
    "createdBy": "api",
    "comment": "test silence"
}