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

Querying Alarm Rules (Recommended)

Function

This API is used to query the alarm rule list.

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

    List

    -

    g:EnterpriseProjectId

    -

    -

URI

GET /v2/{project_id}/alarms

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

alarm_id

No

String

Definition

Alarm rule ID.

Constraints

N/A

Range

The value starts with al and is followed by 22 characters of letters, digits, or a combination of both.

Default Value

N/A

name

No

String

Definition

Alarm name.

Constraints

N/A

Range

The value allows 1 to 128 characters and can only contain digits, letters, underscores (_), and hyphens (-).

Default Value

N/A

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 can contain 0 to 32 characters.

Default Value

N/A

resource_id

No

String

Definition

ID of a resource in an alarm rule.

Constraints

N/A

Range

If the resource has multiple dimensions, the resource IDs are sorted in ascending alphabetical order and separated by commas (,). The value can contain 0 to 700 characters.

Default Value

N/A

enterprise_project_id

No

String

Definition

Enterprise project ID.

Constraints

N/A

Range

The value allows 36 characters. It can only contain lowercase letters, digits, hyphens (-), and underscores (_). You can customize an enterprise project ID. The value can also be 0 (default enterprise project ID) or all_granted_eps (all enterprise project IDs).

Default Value

N/A

product_name

No

String

Definition

Product name. It needs to be specified when alarm rules with multiple dimensions are used. Generally, the value format is Service namespace,First-level dimension of the service, for example, SYS.ECS,instance_id.

Constraints

N/A

Range

[0,128]

Default Value

N/A

resource_level

No

String

Definition

If the value of resource_level is product, cloud product alarm rules with multiple dimensions are used. If the value of resource_level is dimension or not specified, the original rule type is used.

Constraints

N/A

Range

The value can be:

  • product: cloud product

  • dimension: specific dimension

Default Value

N/A

offset

No

Integer

Definition

Pagination offset.

Constraints

N/A

Range

[0,10,000]

Default Value

0

limit

No

Integer

Definition

Number of records displayed on each page.

Constraints

N/A

Range

[1,100]

Default Value

10

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

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

alarms

Array of alarms objects

Definition

Alarm rule list.

Range

1 to 100 characters

count

Integer

Definition

Total number of alarm rules.

Range

[0,10000]

Table 5 alarms

Parameter

Type

Description

alarm_id

String

Definition

Alarm rule ID.

Range

The value starts with al and is followed by 22 characters that may include letters, digits, or a combination of both.

name

String

Definition

Alarm name.

Range

The value allows 1 to 128 characters and can contain digits, letters, underscores (_), and hyphens (-).

description

String

Definition

Alarm description.

Range

[0,256]

namespace

String

Definition

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

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 can contain 0 to 32 characters.

policies

Array of Policy objects

Definition

Alarm policy.

Range

Max. 100 policies

resources

Array of ResourcesInListResp objects

Definition

Resource list. Associated resources can be obtained by calling the API for querying resources in an alarm rule.

Range

Max. 3,000 resources

type

String

Definition

Alarm rule type.

Range

The value can be:

  • ALL_INSTANCE: alarms for all resources

  • RESOURCE_GROUP: alarms for resource groups

  • MULTI_INSTANCE: alarms for specified resources

  • EVENT.SYS: system event alarms

  • EVENT.CUSTOM: custom event alarms

  • DNSHealthCheck: health check alarms

enabled

Boolean

Definition

Whether to enable the alarm rule.

Range

A boolean value.

  • true: enabled

  • false: disabled

notification_enabled

Boolean

Definition

Whether to enable alarm notifications.

Range

A boolean value.

  • true: enabled

  • false: disabled

alarm_notifications

Array of NotificationResp objects

Definition

Notification group or topic subscription for alarm notifications.

Range

A maximum of 10 notification groups or topic subscriptions

ok_notifications

Array of NotificationResp objects

Definition

Information about the notification group or topic subscription when the alarm is cleared.

Range

A maximum of 10 notification groups or topic subscriptions

notification_begin_time

String

Definition

Time when alarm notifications were enabled.

Range

The value allows 1 to 64 characters and can only contain digits and colons (:).

notification_end_time

String

Definition

Time when alarm notifications were disabled.

Range

The value allows 1 to 64 characters and can only contain digits and colons (:).

effective_timezone

String

Definition

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

Range

1 to 16 characters

enterprise_project_id

String

Definition

Enterprise project ID.

Range

Only lowercase letters, digits, and hyphens (-) are allowed.

alarm_template_id

String

Definition

ID of an alarm template associated with an alarm rule. If this parameter is specified, the policy associated with the alarm rule changes accordingly with the alarm template policy.

Range

The value starts with at and allows 2 to 64 characters. It can only contain letters and digits.

product_name

String

Definition

Product name. It needs to be specified when product alarm rules with multiple dimensions are used. Generally, the value format is Service namespace,First-level dimension of the service, for example, SYS.ECS,instance_id.

Range

0 to 128 characters

resource_level

String

Definition

Product alarm rules with multiple dimensions need to be specified as product-level rules. If the value of resource_level is product, it refers to the cloud product level. If the value of resource_level is dimension or not specified, it refers to the sub-dimension level.

Range

The value can be:

  • product: cloud product

  • dimension: specific dimension

tags

Array of ResourceTag objects

Definition

Tenant tags.

Range

A maximum of 20 tags

Table 6 Policy

Parameter

Type

Description

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

period

Integer

Definition

Metric period, in seconds. For details about the original metric period for each cloud service, see Supported Services.

Constraints

N/A

Range

The value can be:

  • 0: The alarm is triggered immediately for event scenarios only.

  • 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

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: In the immediate triggering scenario, 0 indicates that the alarm is not suppressed. In the accumulated triggering scenario, 0 indicates that the alarm is generated only once.

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

level

Integer

Definition

Alarm severity.

Constraints

N/A

Range

The value can be: 1 (critical), ** 2** (major), 3 (minor), or 4 (warning)

Default Value

2

namespace

String

Definition

namespace and dimension_name need to be specified for cloud product-level rules. This is to specify the resources that the policies apply to. 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 0 to 32 characters.

Default Value

N/A

dimension_name

String

Definition

Metric dimension name. For details, see Service Dimension Names. namespace and dimension_name need to be specified for cloud product-level rules. This is to specify the resources that the policies apply to.

Constraints

N/A

Range

A maximum of four dimensions are supported. Example: instance_id for single-dimension scenarios; instance_id,disk for multi-dimension scenarios.

Default Value

N/A

enabled

Boolean

Definition

Whether the alarm policy is enabled. The value can be true (enabled) or false (disabled).

Constraints

N/A

Range

N/A

Default Value

N/A

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

Table 8 ResourcesInListResp

Parameter

Type

Description

resource_group_id

String

Definition

Resource group ID. This parameter is available when the monitoring scope is Resource groups.

Range

The value starts with rg and is followed by 22 characters of letters, digits, or a combination of both.

resource_group_name

String

Definition

Resource group name. This parameter is available when the monitoring scope is Resource groups.

Range

1 to 128 characters

dimensions

Array of MetricDimensionResp objects

Definition

Dimension information.

Table 9 MetricDimensionResp

Parameter

Type

Description

name

String

Definition

Metric dimension name.

Range

The value must start with a letter and can contain 1 to 32 characters.

value

String

Definition

Metric dimension value.

Range

[0,256]

Table 10 NotificationResp

Parameter

Type

Description

type

String

Definition

Notification type.

Range

The value can be:

  • notification: SMN notifications

  • contact: account contacts

  • contactGroup: notification groups

  • autoscaling: AS notifications. It is used only in AS and is not recommended.

  • groupwatch: This API has been deprecated and is not recommended.

  • ecsRecovery: This API has been deprecated and is not recommended.

  • iecAction: This API has been deprecated and is not recommended.

notification_list

Array of strings

Definition

Recipients to be notified of the alarm status changes. The value of topicUrn can be obtained from SMN. For details, see section "Querying Topics".

Table 11 ResourceTag

Parameter

Type

Description

key

String

Definition

Tag name.

Constraints

N/A

Range

Max. 128 Unicode characters

Default Value

N/A

value

String

Definition

Tag value.

Constraints

N/A

Range

Max. 255 Unicode characters

Default Value

N/A

Status code: 400

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

Example Requests

Query alarm rules.

/v2/{project_id}/alarms?offset=0&limit=10

Example Responses

Status code: 200

Query succeeded.

{
  "alarms" : [ {
    "alarm_id" : "al16558829757444BVVxr999",
    "name" : "alarm01",
    "description" : "",
    "namespace" : "SYS.ECS",
    "policies" : [ {
      "metric_name" : "disk_device_read_bytes_rate",
      "period" : 1,
      "filter" : "average",
      "comparison_operator" : ">",
      "value" : 75,
      "unit" : "byte/s",
      "count" : 3,
      "suppress_duration" : 10800,
      "level" : 2
    } ],
    "resources" : [ {
      "dimensions" : [ {
        "name" : "disk_name"
      } ]
    } ],
    "type" : "ALL_INSTANCE",
    "enabled" : true,
    "notification_enabled" : true,
    "alarm_notifications" : [ {
      "type" : "notification",
      "notification_list" : [ "urn:smn:xxx:xxx70e7359:topic_xxx" ]
    } ],
    "ok_notifications" : [ {
      "type" : "notification",
      "notification_list" : [ "urn:smn:xxx:xxx70e7359:topic_xxx" ]
    } ],
    "notification_begin_time" : "00:00",
    "notification_end_time" : "23:59",
    "enterprise_project_id" : "0",
    "tags" : [ {
      "key" : "Usage",
      "value" : "project1"
    } ]
  } ],
  "count" : 1
}

Status Codes

Status Code

Description

200

Query succeeded.

400

Parameter verification failed.

500

Internal system error.

Error Codes

See Error Codes.