Adding a Silence Rule
Function
Alarm silence rules can mask alarm notifications in specified periods. This API is used to create silence rules.
Max.: 100 silence rules. If this number has been reached, delete unnecessary rules.
Once a silence rule is created, it takes effect immediately.
Orchestration only applies to the alarms triggered by Prometheus and log monitoring-related alarm rules.
Calling Method
For details, see Calling APIs.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
aom:muteRule:create
Write
-
-
-
-
URI
POST /v2/{project_id}/alert/mute-rules
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID, which can be obtained from the console or by calling an API. For details, see Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token obtained from IAM. For details, see Obtaining a Token. Constraints N/A Range Min. characters: 1 Max. characters: 40,960 Default Value N/A |
| Content-Type | Yes | String | Definition Message body type (format). Its value is application/json. Constraints N/A Range Fixed value. Default Value application/json |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| create_time | No | Long | Definition Time when the silence rule was created (UTC timestamp, in milliseconds). Example: 2024-10-16 16:03:01 needs to be converted to UTC timestamp 1702759381000 using a tool. Constraints N/A Range N/A Default Value N/A |
| desc | No | String | Definition Rule description. Constraints Max. characters: 1,024 Range N/A Default Value N/A |
| match | No | Array<Array<Match>> | Definition Match condition of the rule. Constraints A maximum of 10 parallel conditions can be configured, and each parallel condition can contain a maximum of 10 serial conditions. A maximum of 100 conditions can be configured. |
| mute_config | Yes | MuteConfig object | Definition Time when the rule takes effect. Constraints N/A |
| name | Yes | String | Definition Rule name. Constraints Enter a maximum of 100 characters, which cannot start or end with an underscore (_). Only letters, digits, and underscores are allowed. Range N/A Default Value N/A |
| timezone | No | String | Definition Time zone. Constraints N/A Range N/A Default Value N/A |
| update_time | No | Long | Definition Time when the silence rule was modified (UTC timestamp, in milliseconds). Example: 2024-10-16 16:03:01 needs to be converted to UTC timestamp 1702759381000 using a tool. Constraints N/A Range N/A Default Value N/A |
| user_id | No | String | Definition ID of the user who created the silence rule. The actual value is the same as the project ID, which can be obtained from the console or by calling an API. For details, see Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| key | Yes | String | Definition Key specified in the metadata for matching. Constraints N/A Range Min. characters: 1 Max. characters: 128 Default Value N/A |
| operate | Yes | String | Definition Matching method of the alarm rule. Constraints N/A Range Default Value N/A |
| value | Yes | Array of strings | Definition Value of the key. Constraints N/A Range Min. characters of an element: 1 Max. characters of an element: 256 Default Value N/A |
Response Parameters
Status code: 204
None
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition Error code. Range N/A |
| error_msg | String | Definition Error message. Range N/A |
| error_type | String | Definition Error type. Range N/A |
| trace_id | String | Definition Request ID. Range N/A |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition Error code. Range N/A |
| error_msg | String | Definition Error message. Range N/A |
| error_type | String | Definition Error type. Range N/A |
| trace_id | String | Definition Request ID. Range N/A |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition Error code. Range N/A |
| error_msg | String | Definition Error message. Range N/A |
| error_type | String | Definition Error type. Range N/A |
| trace_id | String | Definition Request ID. Range N/A |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Response code. |
| error_msg | String | Response message. |
| trace_id | String | Response ID. |
Example Requests
Add a silence rule whose name is "32255" and user ID is "2xxxxxxxxxxxxxxxxxxxxxxxxxcf".
https://{Endpoint}/v2/{project_id}/alert/mute-rules
{
"create_time" : 1668147671966,
"desc" : "",
"match" : [ [ {
"key" : "event_severity",
"operate" : "EQUALS",
"value" : [ "Info" ]
} ] ],
"mute_config" : {
"ends_at" : 86399,
"scope" : [ ],
"starts_at" : 0,
"type" : "DAILY"
},
"name" : "32255",
"timezone" : "xxx",
"update_time" : 1668147671966,
"user_id" : "2xxxxxxxxxxxxxxxxxxxxxxxxxcf"
} Example Responses
Status code: 204
None
Status code: 400
{
"error_code" : "AOM.08011001",
"error_msg" : "the muteName is exist",
"error_type" : "PARAM_INVALID",
"trace_id" : ""
} Status code: 401
{
"error_code" : "AOM.0403",
"error_msg" : "auth failed.",
"error_type" : "AUTH_FAILED",
"trace_id" : ""
} Status code: 403
{
"error_code" : "AOM.0403",
"error_msg" : "auth failed.",
"error_type" : "AUTH_FAILED",
"trace_id" : ""
} Status code: 500
{
"error_code" : "APM.00000500",
"error_msg" : "Internal Server Error",
"trace_id" : ""
} Status Codes
| Status Code | Description |
|---|---|
| 204 | No Content: The request is successful, but no content is returned. |
| 400 | Bad Request: Invalid request. The client should not repeat the request without modifications. |
| 401 | Unauthorized: The authentication information is incorrect or invalid. |
| 403 | Forbidden: The request is rejected. The server has received the request and understood it, but the server refuses to respond to it. The client should not repeat the request without modifications. |
| 500 | Internal Server Error: The server is able to receive the request but unable to understand the request. |
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot