Help Center/ Cloud Eye/ API Reference/ API/ Alarms/ Alarm Rules/ Querying Custom Alarm Templates
Updated on 2026-06-11 GMT+08:00

Querying Custom Alarm Templates

Function

This API is used to query custom alarm templates.

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

    List

    -

    g:EnterpriseProjectId

    -

    -

URI

GET /V1.0/{project_id}/alarm-template

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

alarmTemplateId

No

String

Definition

ID of the custom alarm template, for example, at1603330892378wkDm77y6B.

Constraints

N/A

Range

The value starts with at and allows a maximum of 64 characters. It can contain letters and digits.

Default Value

N/A

namespace

No

String

Definition

Resource type in the custom alarm template, that is, namespace. For example, the namespace of an ECS is SYS.ECS . For details, see Services Interconnected with Cloud Eye.

Constraints

N/A

Range

The value is in the service.item format. The values of service and item must start with a letter and contain only letters, digits, and underscores (_). It can contain 3 to 32 characters.

Default Value

N/A

dname

No

String

Definition

Resource dimension in the custom alarm template. For example, the ECS dimension is instance_id . For the metric dimensions of each resource, see their service documentation. You can navigate there from Services Interconnected with Cloud Eye.

Constraints

N/A

Range

The value allows 1 to 131 characters and can contain only letters, digit, and underscores (_).

Default Value

N/A

start

No

String

Definition

Pagination start position. The value is the ID of an alarm template, for example, at1603330892378wkDm77y6B.

Constraints

N/A

Range

The value starts with at and allows a maximum of 64 characters. It can contain letters and digits.

Default Value

N/A

limit

No

String

Definition

Maximum number of records that can be queried at a time. The value range is (0,100] and the default value is 100. This parameter is used to limit the number of search results.

Constraints

N/A

Range

The value is an integer from 1 to 100.

Default Value

N/A

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

No

String

Definition

MIME type of the request body.

Constraints

N/A

Range

1 to 64 characters

Default Value

Default value application/json; charset=UTF-8 is recommended. For APIs used to upload objects or images, the MIME type varies with the flow type.

X-Auth-Token

No

String

Definition

User token.

Constraints

N/A

Range

1 to 16,384 characters

Default Value

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

alarm_templates

Array of AlarmTemplate objects

Supplementary information about the custom alarm template

meta_data

MetaData object

Definition

Metadata of query results, including the pagination information.

Table 5 AlarmTemplate

Parameter

Type

Description

template_name

String

Definition

Name of a custom alarm template.

Constraints

N/A

Range

The value allows 1 to 256 characters. It must start with a letter and can contain letters, digits, underscores (_), and hyphens (-). Example: alarmTemplate-Test01

Default Value

N/A

template_description

String

Definition

Supplementary information about the custom alarm template.

Constraints

N/A

Range

0 to 256 characters.

Default Value

An empty string.

namespace

String

Definition

Service namespace, which is the resource type selected when you create a custom alarm template. For example, the ECS namespace is SYS.ECS . For details about the namespace of each service, see Services Interconnected with Cloud Eye.

Constraints

N/A

Range

The value is in the service.item format. The values of service and item must start with a letter and contain only letters, digits, and underscores (_). It can contain 3 to 32 characters.

Default Value

N/A

dimension_name

String

Definition

Metric dimension corresponding to the resource type. If the ECS resource type is selected, the value of dimension_name is instance_id . For details about the dimension names of each resource, see their service documentation. You can navigate there from Services Interconnected with Cloud Eye.

Constraints

N/A

Range

The value must start with a letter. Each dimension allows a maximum of 32 characters and can only contain digits, letters, underscores (_), and hyphens (-). Multiple dimensions are separated by commas (,). A maximum of four dimensions are supported. A maximum of 131 characters are allowed. Example: instance_id for single-dimension scenarios and instance_id,disk for multi-dimension scenarios.

Default Value

N/A

template_items

Array of TemplateItem objects

One or more alarm policies added to the custom alarm template.

template_id

String

Definition

ID of the custom alarm template, for example, at1603330892378wkDm77y6B.

Constraints

N/A

Range

The value starts with at and allows a maximum of 64 characters. It can contain letters and digits.

Default Value

N/A

Table 6 TemplateItem

Parameter

Type

Description

metric_name

String

Definition

Metric added to the alarm template. For example, you can add an ECS metric cpu_util . For details about the metric names of each service, see their documentation. You can navigate there from Services Interconnected with Cloud Eye.

Constraints

N/A

Range

1 to 64 characters.

Default Value

N/A

condition

AlarmTemplateCondition object

Alarm policy you created for the custom alarm template.

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

Table 7 AlarmTemplateCondition

Parameter

Type

Description

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.

count

Integer

Definition

Number of consecutive times that an alarm is triggered.

Constraints

N/A

Range

An integer ranging from 1 to 5.

Default Value

N/A

filter

String

Definition

Data aggregation method.

Constraints

When period is set to 1 (original value), the filter field does not take effect. The default value of filter is average. The filter parameter takes effect only when period is greater than 1.

Range

The value can be:

  • average

  • variance

  • min: minimum value.

  • max: maximum value.

  • sum

Default Value

N/A

period

Integer

Definition

Metric period, in seconds. For details about the original metric period for each cloud service, see Services Interconnected with Cloud Eye.

ConstraintsThe value can be:
  • 0: The alarm is triggered immediately. This value applies only to event scenarios.

  • 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

Range

N/A

unit

String

Definition

Data unit.

Constraints

N/A

Range

0 to 32 characters

Default Value

N/A

value

Number

Definition

Alarm threshold. For detailed thresholds, see the value range of each metric in the appendix. For example, you can set ECS cpu_util in Services Interconnected with Cloud Eye to 80 .

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

-1.7976931348623157e+108 to 1.7976931348623157e+108

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

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

Default Value

N/A

Table 8 MetaData

Parameter

Type

Description

count

Integer

Definition

Number of records that can be returned.

Constraints

N/A

Range

[0,2147483647]

Default Value

N/A

total

Integer

Definition

Total number of records.

Constraints

N/A

Range

[0,2147483647]

Default Value

N/A

marker

String

Definition

Start of the next page, which is used for pagination.

Constraints

N/A

Range

[1,9999]

Default Value

N/A

Status code: 400

Table 9 Response body parameters

Parameter

Type

Description

-

String

Request error.

Status code: 401

Table 10 Response body parameters

Parameter

Type

Description

-

String

The authentication information is not provided or is incorrect.

Status code: 403

Table 11 Response body parameters

Parameter

Type

Description

-

String

Access to the requested page is forbidden.

Status code: 408

Table 12 Response body parameters

Parameter

Type

Description

-

String

The request timed out.

Status code: 429

Table 13 Response body parameters

Parameter

Type

Description

-

String

Too many requests.

Status code: 500

Table 14 Response body parameters

Parameter

Type

Description

-

String

Failed to complete the request because of an internal service error.

Status code: 503

Table 15 Response body parameters

Parameter

Type

Description

-

String

The system is currently unavailable.

Example Requests

/V1.0/{project_id}/alarm-template

Example Responses

Status code: 200

OK

{
  "alarm_templates" : [ {
    "template_name" : "alarmTemplate-Test01",
    "template_description" : "This API is used to create a custom alarm template.",
    "namespace" : "SYS.ECS",
    "dimension_name" : "instance_id",
    "template_items" : [ {
      "metric_name" : "cpu_util",
      "condition" : {
        "period" : 1,
        "filter" : "average",
        "comparison_operator" : ">=",
        "value" : 90,
        "unit" : "%",
        "count" : 3,
        "suppress_duration" : 300
      },
      "alarm_level" : 2
    }, {
      "metric_name" : "mem_util",
      "condition" : {
        "period" : 1,
        "filter" : "average",
        "comparison_operator" : ">=",
        "value" : 90,
        "unit" : "%",
        "count" : 3,
        "suppress_duration" : 600
      },
      "alarm_level" : 2
    } ],
    "template_id" : "at1604474818207Jo7o7R4Nj"
  } ],
  "meta_data" : {
    "count" : 1,
    "marker" : "",
    "total" : 1
  }
}

Status Codes

Status Code

Description

200

OK

400

Bad Request

401

Unauthorized

403

Forbidden

408

Request Timeout

429

Too Many Requests

500

Internal Server Error

503

Service Unavailable

Error Codes

See Error Codes.