Help Center/ Cloud Eye/ API Reference/ API V2/ Alarm Masking Rules/ Querying Alarm Masking Rules
Updated on 2025-08-13 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.

URI

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

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Tenant ID.

Constraints:

None

Value range:

Project ID, 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 by calling an API or on the console. For details, see Obtaining a Project ID. The value must contain of 1 to 64 characters.

Default value:

None

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Pagination offset.

Value range:

0-10000

Default value:

0

Regex Pattern: ^([0]|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|10000)$

limit

No

Integer

Number of records on each page.

Value range:

1-100

Default value:

100

Regex Pattern: ^([1-9]|[1-9][0-9]|100)$

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.

Enumeration values:

  • create_time

  • update_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.

Enumeration values:

  • ASC

  • DESC

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

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.

Default value:

application/json; charset=UTF-8

X-Auth-Token

Yes

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)

Enumeration values:

  • ALARM_RULE

  • RESOURCE

  • RESOURCE_POLICY_NOTIFICATION

  • RESOURCE_POLICY_ALARM

  • DEFAULT

relation_ids

Yes

Array of strings

Associated ID (alarm rule ID).

metric_name

No

String

Metric name of a resource. The name must start with a letter and contain only digits, letters, and underscores. The length ranges from 1 to 64 characters. For example, cpu_util of an ECS indicates the CPU usage of the ECS. mongo001_command_ps in DDS indicates the command execution frequency. For details about the metric name of each service, see Service metric name.

resource_level

No

String

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

Enumeration values:

  • dimension

  • product

mask_id

No

String

(Optional) Masking rule ID.

Regex Pattern: ^nm([0-9A-Za-z]){0,62}$

mask_name

No

String

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

Regex Pattern: ^([\u4E00-\u9FFF]|[a-z]|[A-Z]|[0-9]|_|-)+$

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.

Enumeration values:

  • MASK_EFFECTIVE

  • MASK_INEFFECTIVE

resource_id

No

String

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

namespace

No

String

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

dimensions

No

Array of ResourceDimension objects

Resource dimension information.

Table 5 ResourceDimension

Parameter

Mandatory

Type

Description

name

Yes

String

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

Regex Pattern: ^([a-z]|[A-Z]){1}([a-z]|[A-Z]|[0-9]|_|-){1,32}$

value

Yes

String

Value of a resource dimension. It is the instance ID, for example, 4270ff17-aba3-4138-89fa-820594c39755.

Regex Pattern: ^((([a-z]|[A-Z]|[0-9]){1}([a-z]|[A-Z]|[0-9]|_|-|\.)*)|\*){1,256}$

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.

Value range:

0-99999

Table 7 notification_masks

Parameter

Type

Description

notification_mask_id

String

Masking rule ID.

mask_name

String

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

relation_type

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.

Enumeration values:

  • ALARM_RULE

  • RESOURCE

  • RESOURCE_POLICY_NOTIFICATION

  • RESOURCE_POLICY_ALARM

relation_id

String

Association ID.

resource_type

String

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

Enumeration values:

  • ALL_INSTANCE

  • MULTI_INSTANCE

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.

Enumeration values:

  • dimension

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

Enumeration values:

  • UN_MASKED

  • MASK_EFFECTIVE

  • MASK_INEFFECTIVE

mask_type

String

Masking type. 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.

Enumeration values:

  • START_END_TIME

  • FOREVER_TIME

  • CYCLE_TIME

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

Masking start date, in yyyy-MM-dd format.

start_time

String

Masking start time, in HH:mm:ss format.

end_date

String

Masking end date, in yyyy-MM-dd format.

end_time

String

Masking end time, in HH:mm:ss format.

effective_timezone

String

Time zone, for example, GMT-08:00, GMT+08:00, or GMT+0:00.

policies

Array of PoliciesInListResp objects

Alarm policy list.

Table 8 ProductMetric

Parameter

Type

Description

dimension_name

String

Metric dimension information when the masking rule is applied by cloud product. Use commas (,) to separate multiple metric dimensions.

metric_name

String

Metric name of a resource. The name must start with a letter and contain only digits, letters, and underscores. The length ranges from 1 to 64 characters. For example, cpu_util of an ECS indicates the CPU usage of the ECS. mongo001_command_ps in DDS indicates the command execution frequency. For details about the metric name of each service, see Service metric name.

Table 9 ResourceCategory

Parameter

Type

Description

namespace

String

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

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

Metric name of a resource. The name must start with a letter and contain only digits, letters, and underscores. The length ranges from 1 to 64 characters. For example, cpu_util of an ECS indicates the CPU usage of the ECS. mongo001_command_ps in DDS indicates the command execution frequency. For details about the metric name of each service, see Service metric name.

extra_info

MetricExtraInfo object

Additional information about an alarm policy. This parameter is left blank by default.

period

Integer

Period for determining whether to generate an alarm, in seconds. The value can be 1, 300, 1200, 3600, 14400, or 86400. Note: If you set period to 1, Cloud Eye uses raw data to determine whether to trigger an alarm. You can set this parameter to 0 when you set alarm_type to EVENT.SYS or EVENT.CUSTOM.

Enumeration values:

  • 0

  • 1

  • 300

  • 1200

  • 3600

  • 14400

  • 86400

filter

String

Aggregation mode. average: average value; variance: variance; min: minimum value; max: maximum value; sum: sum; tp99: 99 percentile; tp95: 95 percentile; tp90: 90 percentile

comparison_operator

String

Threshold symbol. The value can be >, <, >=, <=, =, !=, cycle_decrease, cycle_increase, or cycle_wave. cycle_decrease indicates the decrease compared with the last period, cycle_increase indicates the increase compared with the last period, and cycle_wave indicates the increase or decrease compared with the last period. All of them can be used in alarm rules for metrics. >, <, >=, <=, =, and != can be used for alarm rules for events.

value

Number

Alarm threshold 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. For detailed thresholds, see the value range of each metric in the appendix. For example, you can set ECS cpu_util to 80. For detailed thresholds, see the value range of each metric in the appendix. For example, you can set ECS cpu_util to 80 in Services Interconnected with Cloud Eye.

hierarchical_value

HierarchicalValue object

Multi-level alarm threshold. If there are both hierarchical_value and value, hierarchical_value prevails.

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

Data unit.

count

Integer

Number of consecutive alarm triggering times. 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.

type

String

Alarm policy type. This API has been deprecated.

suppress_duration

Integer

Interval for triggering alarms. The value can be 0, 300, 600, 900, 1800, 3600, 10800, 21600, 43200, or 86400. 0: Cloud Eye triggers the alarm only once. 300: Cloud Eye triggers an alarm every 5 minutes. 600: Cloud Eye triggers an alarm every 10 minutes. 900: Cloud Eye triggers an alarm every 15 minutes. 1800: Cloud Eye triggers an alarm every 30 minutes. 3600: Cloud Eye triggers an alarm every hour. 10800: Cloud Eye triggers an alarm every 3 hours. 21600: Cloud Eye triggers an alarm every 6 hour. 43200: Cloud Eye triggers an alarm every 12 hours. 86400: Cloud Eye triggers an alarm every day.

Enumeration values:

  • 0

  • 300

  • 600

  • 900

  • 1800

  • 3600

  • 10800

  • 21600

  • 43200

  • 86400

alarm_level

Integer

Alarm severity, which can be 1 (critical), ** 2** (major), 3 (minor), or 4 (informational).

selected_unit

String

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

Table 11 MetricExtraInfo

Parameter

Type

Description

origin_metric_name

String

Original metric name.

Regex Pattern: ^([a-z]|[A-Z]|[0-9]|_|-|~|\.|/|:)*$

metric_prefix

String

Metric name prefix.

Regex Pattern: ^([a-z]|[A-Z]|[0-9]|_|-|~|\.|/|:)*$

custom_proc_name

String

Name of a user process.

metric_type

String

Metric type.

Regex Pattern: ^([a-z]|[A-Z]|[0-9]|_|-|~|\.|/|:)*$

Table 12 HierarchicalValue

Parameter

Type

Description

critical

Double

Threshold for critical alarms.

Value range:

-1.7976931348623156E108-1.7976931348623156E108

major

Double

Threshold for major alarms.

Value range:

-1.7976931348623156E108-1.7976931348623156E108

minor

Double

Threshold for minor alarms.

Value range:

-1.7976931348623156E108-1.7976931348623156E108

info

Double

Threshold for informational alarms.

Value range:

-1.7976931348623156E108-1.7976931348623156E108

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.