Help Center> Cloud Eye> API Reference> API v2> Alarm Notification Masking> Querying Alarm Notification Masking Rules
Updated on 2024-04-30 GMT+08:00

Querying Alarm Notification 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

Specifies the tenant ID.

Minimum: 1

Maximum: 64

Regex Pattern: ^[a-zA-Z0-9-]{1,64}$

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Specifies the pagination offset.

Minimum: 0

Maximum: 10000

Default: 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

Specifies the number of records that will be displayed on each page.

Minimum: 1

Maximum: 100

Default: 100

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

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Specifies the MIME type of the request body. The default type is application/json; charset=UTF-8.

Default: application/json; charset=UTF-8

Minimum: 1

Maximum: 64

X-Auth-Token

Yes

String

Specifies the user token.

Minimum: 1

Maximum: 16384

Table 4 Request body parameters

Parameter

Mandatory

Type

Description

relation_type

Yes

String

Specifies the type of a resource that is associated with an alarm notification masking rule. ALARM_RULE: alarm rules RESOURCE: resources RESOURCE_POLICY_NOTIFICATION: alarm policies for the resource RESOURCE_POLICY_ALARM: alarm policies for the resource (The alarm policies are not used for alarm calculation.) DEFAULT: By default, RESOURCE and RESOURCE_POLICY_NOTIFICATION (used for querying alarm notification masking rules) are included.

Enumeration values:

  • ALARM_RULE
  • RESOURCE
  • RESOURCE_POLICY_NOTIFICATION
  • RESOURCE_POLICY_ALARM
  • DEFAULT

relation_ids

Yes

Array of strings

Specifies the ID of the alarm rule that is associated with the alarm notification masking rule.

Array Length: 1 - 100

mask_id

No

String

(Optional) Specifies the masking rule ID.

Minimum: 1

Maximum: 64

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

mask_name

No

String

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

Minimum: 1

Maximum: 64

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

mask_status

No

String

(Optional) Specifies whether a masking rule is in effect. MASK_EFFECTIVE: The masking rule is in effect. MASK_INEFFECTIVE: The masking rule is not in effect.

Minimum: 1

Maximum: 32

Enumeration values:

  • MASK_EFFECTIVE
  • MASK_INEFFECTIVE

resource_id

No

String

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

Minimum: 1

Maximum: 700

namespace

No

String

Specifies the resource namespace in service.item format. The values of service and item must be character strings, start with a letter, and can contain digits, letters, and underscores (_). A namespace can contain 3 to 32 characters.

dimensions

No

Array of Dimension objects

Specifies the resource dimension information.

Array Length: 1 - 4

Table 5 Dimension

Parameter

Mandatory

Type

Description

name

Yes

String

Specifies the 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 Services Interconnected with Cloud Eye.

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

value

Yes

String

Specifies the value of a resource dimension, which is the resource 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

Specifies the list of alarm notification masking rules.

Array Length: 1 - 100

count

Integer

Specifies the total number of alarm notification masking rules.

Minimum: 0

Maximum: 99999

Table 7 notification_masks

Parameter

Type

Description

notification_mask_id

String

Specifies the masking rule ID.

mask_name

String

Specifies the name of a masking rule.

relation_type

String

Specifies the association type.

Enumeration values:

  • ALARM_RULE
  • RESOURCE
  • RESOURCE_POLICY_NOTIFICATION
  • RESOURCE_POLICY_ALARM

relation_id

String

Specifies the association ID. This parameter is available when relation_type is set to ALARM_RULE.

resources

Array of ResourceCategory objects

Specifies the 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.

Array Length: 1 - 100

mask_status

String

Specifies whether alarm notifications are masked.

Enumeration values:

  • UN_MASKED
  • MASK_EFFECTIVE
  • MASK_INEFFECTIVE

mask_type

String

Specifies the alarm notification 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

start_date

String

Specifies the masking start date, in yyyy-MM-dd format.

start_time

String

Specifies the masking start time, in HH:mm:ss format.

end_date

String

Specifies the masking expiration date, in yyyy-MM-dd format.

end_time

String

Specifies the masking expiration time, in HH:mm:ss format.

policies

Array of PoliciesInListResp objects

Specifies the alarm policy list.

Array Length: 0 - 50

Table 8 ResourceCategory

Parameter

Type

Description

namespace

String

Specifies the resource namespace in service.item format. The values of service and item must be character strings, start with a letter, and can contain digits, letters, and underscores (_). A namespace can contain 3 to 32 characters.

dimension_names

Array of strings

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

Minimum: 1

Maximum: 131

Array Length: 1 - 100

Table 9 PoliciesInListResp

Parameter

Type

Description

alarm_policy_id

String

Specifies the alarm policy ID.

metric_name

String

Specifies the 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

Specifies the extended metric information.

period

Integer

Specifies the period for determining whether to generate an alarm, in seconds. The value can be 1, 300, 1200, 3600, 14400, and 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:

  • 1
  • 300
  • 1200
  • 3600
  • 14400
  • 86400

filter

String

Specifies the data rollup method. The value can be max, min, average, sum, or variance.

Enumeration values:

  • max
  • min
  • average
  • sum
  • variance

comparison_operator

String

Specifies the operator, which can be >, =, <, >=, <=, !=, cycle_decrease, cycle_increase, or cycle_wave. cycle_decrease indicates a decrease compared with the last period. cycle_increase indicates an increase compared with the last period. cycle_wave indicates an increase or decrease compared with the last period.

Enumeration values:

  • >
  • =
  • <
  • >=
  • <=
  • !=
  • cycle_decrease
  • cycle_increase
  • cycle_wave

value

Number

Specifies the alarm threshold. Supported range: 0 to Number. MAX_VALUE (1.7976931348623157e+108) For detailed thresholds, see the value range of each metric in the appendix. For example, you can set Elastic Cloud Server (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. (tag: dt,g42,dt_test,hk_g42,hk_sbc,hws,hws_hk,ocb,sbc,tm)

unit

String

Specifies the data unit.

count

Integer

Specifies the number of consecutive times that alarm conditions are met. Supported range: 1 to 5

type

String

Specifies the alarm policy type. (This parameter is not used currently.)

Minimum: 0

Maximum: 32

suppress_duration

Integer

Specifies the 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

Specifies the alarm severity. The value can be 1 (critical), ** 2** (major), 3 (minor), or 4 (informational).

Table 10 MetricExtraInfo

Parameter

Type

Description

origin_metric_name

String

Specifies the original metric name.

Minimum: 1

Maximum: 4096

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

metric_prefix

String

Specifies the metric name prefix.

Minimum: 1

Maximum: 4096

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

custom_proc_name

String

Specifies the name of a user process.

Minimum: 1

Maximum: 250

metric_type

String

Specifies the metric type.

Minimum: 1

Maximum: 32

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

Status code: 400

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Specifies the status codes customized by each cloud service when a request error occurs.

Minimum: 0

Maximum: 256

error_msg

String

Specifies the request error message.

Minimum: 0

Maximum: 256

request_id

String

Specifies the request ID.

Minimum: 0

Maximum: 256

Status code: 500

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Specifies the status codes customized by each cloud service when a request error occurs.

Minimum: 0

Maximum: 256

error_msg

String

Specifies the request error message.

Minimum: 0

Maximum: 256

request_id

String

Specifies the request ID.

Minimum: 0

Maximum: 256

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",
    "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

Failed to verify parameters.

500

Internal system error.

Error Codes

See Error Codes.