Creating Alarm Masking Rules in Batches
Function
This API is used to create alarm masking rules in batches.
URI
PUT /v2/{project_id}/notification-masks
Parameter | Mandatory | Type | Description |
|---|---|---|---|
project_id | Yes | String | Definition Project ID. It is used to specify the project that an asset belongs to. You can query the assets of a project by project ID. You can obtain the project ID from the API or console. For details, see Obtaining a Project ID. Constraints N/A Range 1 to 64 characters Default Value N/A |
Request Parameters
Parameter | Mandatory | Type | Description |
|---|---|---|---|
Content-Type | No | String | Definition MIME type of the request body. Constraints: None Value range: The value can contain 1 to 64 characters. Default value: The default type is application/json; charset=UTF-8. |
X-Auth-Token | No | String | Definition User token. Constraints: None Value range: The value can contain 1 to 16,384 characters. Default value: None |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
mask_name | No | String | Definition Masking rule name. Constraints N/A Range The value allows 1 to 64 characters. It can only contain letters, digits, hyphens (-), and underscores (_). Default Value N/A |
relation_type | Yes | String | Definition Method for masking alarm notifications or calculation. Constraints N/A Range The value allows 1 to 32 characters and can only be:
Default Value N/A |
relation_ids | Yes | Array of strings | Alarm rule or alarm policy ID. If you set relation_type to ALARM_RULE, set this parameter to the ID of the masked alarm rule. If you set relation_type to RESOURCE_POLICY_NOTIFICATION or RESOURCE_POLICY_ALARM, set this parameter to the ID of the masked alarm policy. |
resources | No | Array of Resource objects | Associated resource. It is required when you set relation_type to RESOURCE, RESOURCE_POLICY_NOTIFICATION, or RESOURCE_POLICY_ALARM. |
metric_names | No | Array of strings | Name of the associated metric. This parameter is optional when relation_type is set to RESOURCE. If this parameter is left blank, the masking rule will be applied to all metrics of the resource. |
product_metrics | No | Array of ProductMetric objects | Metric information when the masking rule is applied by cloud product. |
resource_level | No | String | dimension indicates the sub-dimension, and product indicates the cloud product. |
product_name | No | String | Cloud product name specified when Cloud product is selected for Resource Level. |
mask_type | Yes | String | Definition Masking type. Constraints N/A Range The value can be:
Default Value N/A |
start_date | No | String | Definition Masking start date. Constraints N/A Range The value contains 10 characters and is in the yyyy-MM-dd format. Default Value N/A |
start_time | No | String | Definition Masking start time. Constraints N/A Range The value contains eight characters in the HH:mm:ss format. Default Value N/A |
end_date | No | String | Definition Masking end date. Constraints N/A Range The value contains 10 characters and is in the yyyy-MM-dd format. Default Value N/A |
end_time | No | String | Definition Masking end time. Constraints N/A Range The value contains eight characters in the HH:mm:ss format. Default Value N/A |
effective_timezone | No | String | Definition Time zone, for example, GMT-08:00, GMT+08:00, or GMT+0:00. Constraints N/A Range 1 to 16 characters Default Value N/A |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
namespace | Yes | String | Definition Namespace of a service. For details about the namespace of each service, see Namespace. Constraints N/A Range The value is in the service.item format. The values of service and item must be a string, starting with a letter and containing only digits (0–9), letters (case-insensitive), and underscores (_). The value must contain 3 to 32 characters. Default Value N/A |
dimensions | Yes | Array of ResourceDimension objects | Definition Resource dimension information. Constraints A maximum of four dimensions are allowed. |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
name | Yes | String | Definition Dimension of a resource. For example, the dimension of an ECS can be instance_id. A maximum of four dimensions are supported. For the metric dimension of each resource, see Service Metric Dimensions. Constraints N/A Range The value starts with a letter and allows 1 to 32 characters. It can contain letters, digits, underscores (_), and hyphens (-). Default Value N/A |
value | Yes | String | Definition Resource dimension value, which is an instance ID, for example, 4270ff17-aba3-4138-89fa-820594c39755. Constraints N/A Range 1 to 256 characters Default Value N/A |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
dimension_name | Yes | String | Definition Metric dimensions when the masking rule is applied by cloud product. Constraints N/A Range The value contains 0 to 128 characters. Multiple dimensions are separated by commas (,). Default Value N/A |
metric_name | Yes | String | Definition Metric name of a resource. For details about the metrics of each service, see Service Metric Names. Constraints N/A Range The value must start with a letter and can only contain digits, letters, underscores (_), and hyphens (-). 1 to 96 characters For example, the ECS metric cpu_util indicates the CPU usage of an ECS. The DDS metric mongo001_command_ps indicates the command execution frequency. Default Value N/A |
Response Parameters
Status code: 201
Parameter | Type | Description |
|---|---|---|
relation_ids | Array of strings | IDs of associated alarm rules or policies that were successfully created. |
notification_mask_id | String | Masking rule ID. |
Status code: 400
Parameter | Type | Description |
|---|---|---|
error_code | String | Status codes customized by each cloud service when a request error occurs. |
error_msg | String | Request error message. |
request_id | String | Request ID. |
Status code: 500
Parameter | Type | Description |
|---|---|---|
error_code | String | Status codes customized by each cloud service when a request error occurs. |
error_msg | String | Request error message. |
request_id | String | Request ID. |
Example Requests
{
"mask_name" : "mn_test",
"relation_type" : "ALARM_RULE",
"relation_ids" : [ "al123232232341232132" ],
"resources" : [ {
"namespace" : "SYS.ECS",
"dimensions" : [ {
"name" : "instance_id",
"value" : "4270ff17-aba3-4138-89fa-820594c39755"
} ]
} ],
"mask_type" : "START_END_TIME",
"start_date" : "yyyy-MM-dd",
"start_time" : "HH:mm:ss",
"end_date" : "yyyy-MM-dd",
"end_time" : "HH:mm:ss"
} Example Responses
Status code: 201
Notification masking rules created.
{
"relation_ids" : [ "al123232232341232132" ],
"notification_mask_id" : "nm123232232341232132"
} Status Codes
Status Code | Description |
|---|---|
201 | Notification masking rules created. |
400 | Parameter verification failed. |
500 | Internal system error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.

