Help Center/ Cloud Eye/ API Reference/ API V2/ Alarm Templates/ Querying Details of an Alarm Template
Updated on 2025-10-30 GMT+08:00

Querying Details of an Alarm Template

Function

This API is used to query details of an alarm template.

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

    Read

    -

    g:EnterpriseProjectId

    • ces:customAlarmTemplates:list

    -

URI

GET /v2/{project_id}/alarm-templates/{template_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

template_id

Yes

String

ID of an alarm template. The ID starts with at and is followed by up to 64 characters, including letters and digits.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Tenant token.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

template_id

String

ID of an alarm template. The ID starts with at and is followed by up to 64 characters, including letters and digits.

template_name

String

Definition

Alarm template name.

Constraints

N/A

Range

The value allows 1 to 128 characters. It must start with a letter and can only contain letters, digits, underscores (_), and hyphens (-).

Default Value

N/A

template_type

String

Type of an alarm template. custom indicates custom alarm templates, and system indicates default alarm templates.

create_time

String

Time when an alarm template was created.

template_description

String

Definition

Alarm template description.

Constraints

N/A

Range

[0,256]

Default Value

An empty string

policies

Array of AlarmTemplatePolicies objects

Alarm policies in an alarm template.

Table 4 AlarmTemplatePolicies

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_name

String

Definition

Resource dimension.

Constraints

The DimensionName field of the event alarm template is empty.

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. Example: instance_id for single-dimension scenarios and instance_id,disk for multi-dimension scenarios.

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

period

Integer

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

filter

String

Data rollup method.

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

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

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

Data unit. The value can contain up to 32 characters.

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

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

suppress_duration

Integer

Alarm suppression period, in seconds. When the period is 0, only one alarm is generated.

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 5 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 6 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: 401

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

Table 8 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: 404

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

Querying details of an alarm template.

/v2/{project_id}/alarm-templates/{template_id}

Example Responses

Status code: 200

OK

{
  "template_id" : "at1628592157541dB1klWgY6",
  "template_name" : "my_template",
  "template_type" : "custom",
  "create_time" : "2006-01-02T15:04:05.000Z",
  "template_description" : "hello world",
  "policies" : [ {
    "namespace" : "SYS.ECS",
    "dimension_name" : "instance_id",
    "metric_name" : "cpu_util",
    "period" : 300,
    "filter" : "sum",
    "comparison_operator" : ">",
    "value" : 2,
    "hierarchical_value" : {
      "major" : 85
    },
    "unit" : "bit/s",
    "selected_unit" : "",
    "count" : 2,
    "alarm_level" : 2,
    "suppress_duration" : 300
  } ]
}

Status Codes

Status Code

Description

200

OK

400

Parameter verification failed.

401

Not authenticated.

403

Authentication failed.

404

Resource not found.

500

Internal system error.

Error Codes

See Error Codes.