Help Center/ Cloud Eye/ API Reference/ API/ Alarms/ Alarm Masking Rules/ Creating Alarm Masking Rules in Batches
Updated on 2026-06-11 GMT+08:00

Creating Alarm Masking Rules in Batches

Function

This API is used to create alarm masking rules in batches.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

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

    ces:alarms:putNotificationMaskRules

    Write

    -

    g:EnterpriseProjectId

    ces:notificationMasks:update

    -

URI

PUT /v2/{project_id}/notification-masks

Table 1 Path Parameters

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

Table 2 Request header 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

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

mask_name

No

String

Definition

Mandatory. 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.

Constraints

N/A

Range

The value can be:

  • ALARM_RULE: by alarm rule.

  • RESOURCE: by resource.

  • RESOURCE_POLICY_NOTIFICATION: by alarm policy.

  • RESOURCE_POLICY_ALARM: (discarded and not recommended) by alarm policy.

  • EVENT.SYS: by event.

Default Value

N/A

relation_ids

Yes

Array of strings

Definition

Association IDs.

Constraints

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, set this parameter to the ID of the masked alarm policy. You can specify 1 to 100 IDs.

resources

No

Array of Resource objects

Definition

Mandatory. Associated resource IDs.

Constraints

If relation_type is set to RESOURCE or RESOURCE_POLICY_NOTIFICATION, set this parameter to the information about the masked resources. You can specify 1 to 100 resources.

metric_names

No

Array of strings

Definition

Associated metric name.

Constraints

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. You can specify up to 50 metrics.

product_metrics

No

Array of ProductMetric objects

Definition

Metric information when the masking rule is applied by cloud product.

Constraints

You can specify up to 50 metrics.

resource_level

No

String

Definition

Resource level.

Constraints

N/A

Range

The value can be:

  • product: cloud product.

  • dimension: specific dimension.

Default Value

N/A

product_name

No

String

Definition

Name of a cloud product when the resource level is cloud product.

Constraints

N/A

Range

0 to 128 characters.

Default Value

N/A

mask_type

Yes

String

Definition

Masking type.

Constraints

N/A

Range

The value can be:

  • START_END_TIME: Alarms are masked by start time and end time.

  • FOREVER_TIME: Alarms are masked permanently.

  • CYCLE_TIME: Alarms are masked by period.

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

Table 4 Resource

Parameter

Mandatory

Type

Description

namespace

Yes

String

Definition

Namespace of the service. For details, see Services Interconnected with Cloud Eye.

Constraints

N/A

Range

The value is in the service.item format. The values of service and item must start with a letter and contain only letters, digits, and underscores (_). It can contain 3 to 32 characters.

Default Value

N/A

dimensions

Yes

Array of ResourceDimension objects

Definition

Resource dimension information. The value * indicates all resources.

Constraints

You can specify 1 to 4 dimensions.

Table 5 ResourceDimension

Parameter

Mandatory

Type

Description

name

Yes

String

Definition

Dimension of a resource. For example, the dimension of an ECS is instance_id . For details about the dimension names of each resource, see their service documentation. You can navigate there from Services Interconnected with Cloud Eye.

Constraints

N/A

Range

The value starts with a letter and allows 1 to 32 characters. It can contain only 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

Table 6 ProductMetric

Parameter

Mandatory

Type

Description

dimension_name

Yes

String

Definition

Resource dimension information when the masking rule is applied by cloud product.

Constraints

N/A

Range

The value contains up 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 metric names of each resource, see their service documentation. You can navigate there from Services Interconnected with Cloud Eye.

Constraints

N/A

Range

The value must start with a letter and can only contain letters, digits, underscores (_), and hyphens (-). It allows 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

Table 7 Response body parameters

Parameter

Type

Description

relation_ids

Array of strings

Definition

IDs of associated alarm rules or policies that were successfully created.

notification_mask_id

String

Definition

Masking rule ID.

Range

The value starts with nm and is followed by up to 62 characters of letters, digits, or a combination of both.

Status code: 400

Table 8 Response body parameters

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

Table 9 Response body parameters

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.