Help Center/ Cloud Eye/ API Reference/ API V2/ Alarm Masking Rules/ Modifying an Alarm Masking Rule
Updated on 2025-10-30 GMT+08:00

Modifying an Alarm Masking Rule

Function

This API is used to modify an alarm masking rule.

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/{notification_mask_id}

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

notification_mask_id

Yes

String

Definition

Masking rule ID.

Constraints

N/A

Range

The value allows 1 to 64 characters and can only contain letters and digits.

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

Yes

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_ids

No

Array of strings

Definition

Relation ID.

Constraints

Array length: [1,100]

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.

relation_type

No

String

Definition

Method for masking alarm notifications or calculation.

Constraints

N/A

Range

The value allows 1 to 32 characters and can only be:

  • ALARM_RULE: masking alarm notifications by alarm rule

  • RESOURCE: masking alarm notifications by resource

  • RESOURCE_POLICY_NOTIFICATION: masking alarm notifications by resource or alarm policy

  • RESOURCE_POLICY_ALARM: masking alarm calculation by resource or alarm policy

Default Value

N/A

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.

resources

Yes

Array of Resource objects

Definition

Associated resources.

Constraints

Array length: [1,100]

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 ProductMetric

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

Table 5 Resource

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.

Table 6 ResourceDimension

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

Response Parameters

Status code: 204

No Content

Status code: 400

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

Example Requests

{
  "mask_name" : "mn_test",
  "relation_ids" : [ "al123232232341232132" ],
  "relation_type" : "ALARM_RULE",
  "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

None

Status Codes

Status Code

Description

204

No Content

400

Parameter verification failed.

500

Internal system error.

Error Codes

See Error Codes.