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

Querying Alarm Masking Rules

Function

This API is used to query notification masking rules of a specified type in batches. Currently, a maximum of 100 notification masking rules can be queried 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:listNotificationMaskRules

    List

    -

    g:EnterpriseProjectId

    • ces:notificationMasks:list

    -

URI

POST /v2/{project_id}/notification-masks/batch-query

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

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Pagination offset.

limit

No

Integer

Number of records on each page.

sort_key

No

String

Sorting keyword, which is used together with sort_dir.

The value can be create_time or update_time.

create_time indicates sorting by creation time, and update_time indicates sorting by modification time.

sort_dir

No

String

Sorting order, which is used together with sort_key. DESC indicates the descending order, and ASC indicates the ascending order.

Request Parameters

Table 3 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 4 Request body parameters

Parameter

Mandatory

Type

Description

relation_type

Yes

String

Method for masking alarm notifications or calculation. 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: RESOURCE and RESOURCE_POLICY_NOTIFICATION (used only for querying alarm masking rules)

relation_ids

Yes

Array of strings

Associated ID (alarm rule ID).

metric_name

No

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

resource_level

No

String

dimension indicates the sub-dimension, and product indicates the cloud product.

mask_id

No

String

(Optional) Masking rule ID.

mask_name

No

String

(Optional) Masking rule name. The value can contain up to 64 characters, including only letters, digits, hyphens (-), and underscores (_).

mask_status

No

String

Masking status. This parameter is optional. MASK_EFFECTIVE: The masking rule is in effect. MASK_INEFFECTIVE: The masking rule is not in effect.

resource_id

No

String

(Optional) Resource dimension value. You can specify one or more resource IDs from one dimension.

namespace

No

String

Definition

Namespace of a service. For details about the namespace of each service, see Service Namespaces.

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

No

Array of ResourceDimension objects

Resource dimension information.

Table 5 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: 200

Table 6 Response body parameters

Parameter

Type

Description

notification_masks

Array of notification_masks objects

List of alarm notification masking rules.

count

Integer

Total number of alarm notification masking rules.

Table 7 notification_masks

Parameter

Type

Description

notification_mask_id

String

Masking rule ID.

mask_name

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

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

relation_id

String

Definition

Relation ID.

Constraints

N/A

Range

The value can be an alarm rule ID or alarm policy ID. It allows 1 to 64 characters and can only contain letters, digits, and hyphens (-).

Default Value

N/A

resource_type

String

Masked resource type. The value can be ALL_INSTANCE (all resources) or ** MULTI_INSTANCE (multi-instance resources).

metric_names

Array of strings

Name of the associated metric. This parameter is available when relation_type is set to RESOURCE.

product_metrics

Array of ProductMetric objects

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

resource_level

String

dimension indicates the sub-dimension, and product indicates the cloud product.

product_name

String

Cloud product name specified when Cloud product is selected for Resource Level.

resources

Array of ResourceCategory objects

Associated resource type. This parameter is available when relation_type is set to RESOURCE. You only need to query the namespace and dimension name of the resource.

mask_status

String

Masking status. UN_MASKED: Alarm notifications are not masked. MASK_EFFECTIVE: Masking rules are in effect. MASK_INEFFECTIVE: Masking rules are not in effect.

mask_type

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

create_time

Integer

Time the alarm masking is created. The value is a UNIX timestamp and the unit is ms.

update_time

Integer

Time the alarm masking is updated. The value is a UNIX timestamp and the unit is ms.

start_date

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

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

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

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

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

policies

Array of PoliciesInListResp objects

Alarm policy list.

Table 8 ProductMetric

Parameter

Type

Description

dimension_name

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

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 9 ResourceCategory

Parameter

Type

Description

namespace

String

Definition

Namespace of a service. For details about the namespace of each service, see Service Namespaces.

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

dimension_names

Array of strings

Resource dimension information. Multiple dimensions are sorted in alphabetical order and separated with commas (,).

Table 10 PoliciesInListResp

Parameter

Type

Description

alarm_policy_id

String

Alarm policy ID.

metric_name

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

extra_info

MetricExtraInfo object

Definition

Additional information about the alarm policy.

Constraints

N/A

period

Integer

Definition

Interval (seconds) for checking whether the alarm rule conditions are met.

Constraints

N/A

Range

The value can be:

  • 0: default value. This value can be used for event alarms.

  • 1: original metric period. For example, if the original period of an RDS metric is 60s, the metric data is collected and calculated every 60s.

  • 300: The metric data is collected and calculated every 5 minutes.

  • 1200: The metric data is collected and calculated every 20 minutes.

  • 3600: The metric data is collected and calculated every hour.

  • 14400: The metric data is collected and calculated every 4 hours.

  • 86400: The metric data is collected and calculated every day.

Default Value

N/A

filter

String

Definition

Aggregation method.

Constraints

N/A

Range

average, variance, min, max, or sum

Default Value

N/A

comparison_operator

String

Definition

Threshold symbol.

Constraints

The threshold symbols for metric alarms are >, >=, <, <=, =, !=, cycle_decrease, cycle_increase, and cycle_wave. The threshold symbols for event alarms are >, >=, <, <=, =, and !=.

Range

The value can be >, <, >=, <=, =, !=, cycle_decrease, cycle_increase, or cycle_wave. cycle_decrease indicates the decrease relative to the last period; cycle_increase indicates the increase relative to the last period; cycle_wave indicates the increase or decrease relative to the last period.

Default Value

N/A

value

Number

Definition

Alarm threshold. For specific thresholds, see the value range of each metric in the appendix.

Constraints

If there is only one threshold, value and alarm_level are used in pairs. If there are both hierarchical_value and value, hierarchical_value is used.

Range

The value ranges from -1.7976931348623157e+108 to 1.7976931348623157e+108.

Default Value

N/A

hierarchical_value

HierarchicalValue object

Definition

Multi-level alarm threshold.

Constraints

If there are both hierarchical_value and value, hierarchical_value is used.

When you create or modify an alarm rule, you can set only one threshold in the following scenarios:

  1. The alarm type is Metric and the alarm policy is Trigger an alarm when all policies are met.

  2. The alarm type is Event.

unit

String

Definition

Data unit.

Constraints

N/A

Range

[0,32]

Default Value

N/A

count

Integer

Definition

Number of times that the alarm triggering conditions are met.

Constraints

N/A

Range

For event alarms, the value ranges from 1 to 180. For metric and website alarms, the value can be 1, 2, 3, 4, 5, 10, 15, 30, 60, 90, 120, or 180.

Default Value

N/A

type

String

Alarm policy type. This API has been deprecated.

suppress_duration

Integer

Definition

Alarm suppression duration, in seconds. This parameter corresponds to the last field in the alarm policy when you create an alarm rule. This field is used to mitigate frequent alarm occurrences.

Constraints

N/A

Range

The value can be:

  • 0: A metric alarm is generated only once. An event alarm is not suppressed in the immediate triggering scenario, and is generated only once in the accumulated triggering scenario.

  • 300: An alarm is generated every 5 minutes once the alarm triggering condition is met.

  • 600: An alarm is generated every 10 minutes once the alarm triggering condition is met.

  • 900: An alarm is generated every 15 minutes once the alarm triggering condition is met.

  • 1800: An alarm is generated every 30 minutes once the alarm triggering condition is met.

  • 3600: An alarm is generated every 60 minutes once the alarm triggering condition is met.

  • 10800: An alarm is generated every 3 hours once the alarm triggering condition is met.

  • 21600: An alarm is generated every 6 hours once the alarm triggering condition is met.

  • 43200: An alarm is generated every 12 hours once the alarm triggering condition is met.

  • 86000: An alarm is generated once every day once the alarm triggering condition is met.

Default Value

N/A

alarm_level

Integer

Definition

Alarm severity.

Constraints

N/A

Range

The value can be:

  • 1: critical

  • 2: major

  • 3: minor

  • 4: warning

Default Value

N/A

selected_unit

String

Definition

The metric unit you selected. It is used for subsequent metric data display and calculation.

Constraints

N/A

Range

[0,64]

Default Value

N/A

Table 11 MetricExtraInfo

Parameter

Type

Description

origin_metric_name

String

Definition

Original metric name.

Constraints

N/A

Range

0 to 4,096 characters

Default Value

N/A

metric_prefix

String

Definition

Metric name prefix.

Constraints

N/A

Range

0 to 4,096 characters

Default Value

N/A

custom_proc_name

String

Definition

Name of a process.

Constraints

N/A

Range

[0,250]

Default Value

N/A

metric_type

String

Definition

Metric type.

Constraints

N/A

Range

0 to 32 characters

Default Value

N/A

Table 12 HierarchicalValue

Parameter

Type

Description

critical

Double

Definition

Threshold for critical alarms.

Constraints

N/A

Range

[-1.7976931348623157e+108, 1.7976931348623157e+108]

Default Value

N/A

major

Double

Definition

Threshold for major alarms.

Constraints

N/A

Range

[-1.7976931348623157e+108, 1.7976931348623157e+108]

Default Value

N/A

minor

Double

Definition

Threshold for minor alarms.

Constraints

N/A

Range

[-1.7976931348623157e+108, 1.7976931348623157e+108]

Default Value

N/A

info

Double

Definition

Threshold for warnings.

Constraints

N/A

Range

[-1.7976931348623157e+108, 1.7976931348623157e+108]

Default Value

N/A

Status code: 400

Table 13 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 14 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

{
  "relation_type" : "DEFAULT",
  "relation_ids" : [ "al123232232341232132" ],
  "mask_id" : "nm1689737291469aj38xNVLK",
  "mask_name" : "mn_test",
  "mask_status" : "MASK_EFFECTIVE",
  "resource_id" : "dse23xw43",
  "namespace" : "SYS.ECS",
  "dimensions" : [ {
    "name" : "instance_id",
    "value" : "4270ff17-aba3-4138-89fa-820594c39755"
  } ]
}

Example Responses

Status code: 200

Notification masking rules queried.

{
  "notification_masks" : [ {
    "notification_mask_id" : "nm123232232341232132",
    "mask_name" : "mn_test",
    "relation_type" : "ALARM_RULE",
    "relation_id" : "al123232232341232132",
    "resource_type" : "MULTI_INSTANCE",
    "resources" : [ {
      "namespace" : "SYS.ECS",
      "dimension_names" : [ "disk_utils,instance_id" ]
    } ],
    "mask_status" : "UN_MASKED",
    "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",
    "policies" : [ {
      "alarm_policy_id" : "0f921f55-89b1-4534-ae54-7b40b597b5a6",
      "metric_name" : "cpu_util",
      "extra_info" : {
        "origin_metric_name" : "disk_usedPercent",
        "metric_prefix" : "SlAsh_",
        "custom_proc_name" : "proc_zombie_count1",
        "metric_type" : "string"
      },
      "period" : 300,
      "filter" : "average",
      "comparison_operator" : ">",
      "value" : 0,
      "unit" : "%",
      "count" : 3,
      "type" : "string",
      "suppress_duration" : 300,
      "alarm_level" : 2
    } ]
  } ],
  "count" : 100
}

Status Codes

Status Code

Description

200

Notification masking rules queried.

400

Parameter verification failed.

500

Internal system error.

Error Codes

See Error Codes.