Help Center/ Application Operations Management/ API Reference/ APIs/ Alarm/ Querying the Alarm Template List
Updated on 2025-06-27 GMT+08:00

Querying the Alarm Template List

Function

This API is used to query the alarm template list.

Calling Method

For details, see Calling APIs.

URI

GET /v4/{project_id}/alarm-rules-template

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID, which can be obtained from the console or by calling an API. For details, see Obtaining a Project ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

id

No

String

Alarm template ID.

type

No

String

Alarm template type.

  • If the value of type is promql, the default CCE template is returned.

  • If type is set to another value or left blank, all templates are returned.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token obtained from IAM. For details, see Obtaining a Token.

Content-Type

No

String

Message body type or format. Content type, which is application/json.

Enterprise-Project-Id

No

String

Enterprise project ID. For details, see Obtaining an Enterprise Project ID.

  • To query the instances in an enterprise project, enter the enterprise project ID.

  • To query the instances in all enterprise projects, enter all_granted_eps.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

alarm_rule_templates

Array of AlarmRuleTemplateBody objects

Alarm template list.

count

Integer

Total number of alarm templates.

Table 5 AlarmRuleTemplateBody

Parameter

Type

Description

alarm_rule_template_name

String

Alarm template name.

alarm_rule_template_name_en

String

Name of an alarm template.

alarm_rule_template_description

String

Alarm template description.

alarm_rule_template_id

String

Alarm template ID.

alarm_rule_template_project_id

String

Project ID, which can be obtained from the console or by calling an API. For details, see Obtaining a Project ID.

alarm_rule_template_type

String

Alarm template type.

  • statics: static alarm template.

  • dynamic: dynamic alarm template.

alarm_rule_template_source

String

Source of an alarm template.

alarm_rule_template_binding

Map<String,String>

Alarm rule bound to the alarm template.

alarm_template_spec_list

Array of AlarmRuleTemplateSpecWithCloudService objects

List of rules in an alarm template.

enterprise_project_id

String

Enterprise project ID. For details, see Obtaining an Enterprise Project ID.

create_time

Long

Creation time.

modify_time

Long

Update time.

templating

Templating object

List of variables in an alarm template.

template_version

String

Version of an alarm template.

Table 6 AlarmRuleTemplateSpecWithCloudService

Parameter

Type

Description

related_cloud_service

String

Associated cloud service.

related_cce_clusters

Array of strings

Associated CCE cluster.

related_prometheus_instances

Array of strings

Associated Prometheus instance.

alarm_notification

AlarmNotification object

Notification information.

alarm_template_spec_items

Array of AlarmTemplateSpecItem objects

Alarm template list.

Table 7 AlarmNotification

Parameter

Type

Description

notification_type

String

Notification type.

  • direct: direct alarm reporting

  • alarm_policy: alarm reporting after noise reduction

Enumeration values:

  • direct

  • alarm_policy

route_group_enable

Boolean

Whether to enable a grouping rule.

  • If the notification type is alarm_policy, set this parameter to true.

  • If the notification type is direct, set this parameter to false.

If both notify_triggered and notify_resolved are set to false, route_group_enable must be set to false.

Enumeration values:

  • true

  • false

route_group_rule

String

Grouping rule name.

  • If route_group_enable is set to true, enter a grouping rule name.

  • If route_group_enable is set to false, enter "".

notification_enable

Boolean

Whether to enable an alarm action rule.

  • If the notification type is direct, set this parameter to true.

  • If the notification type is alarm_policy, set this parameter to false.

If both notify_triggered and notify_resolved are set to false, notification_enable must be set to false.

bind_notification_rule_id

String

Alarm action rule ID.

  • If notification_enable is set to true, enter an alarm action rule ID.

  • If notification_enable is set to false, enter "".

notify_resolved

Boolean

Whether to send a notification when an alarm is cleared.

  • true: Send a notification.

  • false: Do not send any notification.

Enumeration values:

  • true

  • false

notify_triggered

Boolean

Whether to send a notification when an alarm is triggered.

  • true: Send a notification.

  • false: Do not send any notification.

Enumeration values:

  • true

  • false

notify_frequency

Integer

Notification frequency.

  • If the notification type is alarm_policy, set this parameter to -1.

  • If the notification type is direct, set this parameter to any of the following:

  • 0: alarm sent only once

  • 300: every 5 minutes

  • 600: every 10 minutes

  • 900: every 15 minutes

  • 1800: every 30 minutes

  • 3600: every hour

  • 10800: every 3 hours

  • 21600: every 6 hours

  • 43200: every 12 hours

  • 86400: every day

Table 8 AlarmTemplateSpecItem

Parameter

Type

Description

alarm_template_name

String

Name of an alarm rule in an alarm template.

alarm_template_name_en

String

Name of an alarm rule in an alarm template.

desc

String

Description of an alarm rule in an alarm template.

desc_en

String

Description of an alarm rule in an alarm template.

alarm_template_spec_type

String

Type of an alarm rule.

  • metric: metric alarm rule.

  • event: event alarm rule.

metric_alarm_template_spec

MetricAlarmTemplateSpec object

Metric alarm template.

event_alarm_template_spec

EventAlarmTemplateSpec object

Event alarm template.

Table 9 MetricAlarmTemplateSpec

Parameter

Type

Description

alarm_subtype

String

Alarm rule type.

alarm_source

String

Alarm source, for example, CCE.

monitor_type

String

Monitoring type.

trigger_conditions

Array of TemplateTriggerCondition objects

Trigger condition.

no_data_conditions

Array of NoDataCondition objects

Action taken when data is insufficient.

alarm_tags

Array of AlarmTags objects

Alarm tag.

recovery_conditions

RecoveryCondition object

Alarm clearance condition.

Table 10 TemplateTriggerCondition

Parameter

Type

Description

metric_query_mode

String

Metric query mode.

  • AOM: native AOM

  • PROM: AOM Prometheus

  • NATIVE_PROM: native Prometheus

Enumeration values:

  • AOM

  • PROM

  • NATIVE_PROM

metric_namespace

String

Metric namespace.

metric_name

String

Metric name.

metric_unit

String

Metric unit.

metric_labels

Array of strings

Metric dimension.

promql

String

Prometheus statement.

promql_expr

Array of strings

Prometheus statement template.

trigger_times

String

Number of consecutive periods.

trigger_interval

String

Check interval.

  • If trigger_type is set to HOURLY*, set this parameter to "".

  • If trigger_type is set to DAILY, set 00:00–23:00. Example: 03:00.

  • If trigger_type is set to WEEKLY, select a day in a week and then select 00:00–23:00. Example: **1 03:00" indicates 03:00 on every Monday.

  • If trigger_type is set to CRON, specify a standard cron expression.

  • If trigger_type is set to FIXED_RATE, select 15s, 30s, 1–59 min, or 1–24 h.

trigger_type

String

Trigger type.

  • FIXED_RATE: fixed interval

  • HOURLY: every hour

  • DAILY: every day

  • WEEKLY: every week

  • CRON: Cron expression

Enumeration values:

  • FIXED_RATE

  • HOURLY

  • DAILY

  • WEEKLY

  • CRON

promql_for

String

Native Prometheus monitoring duration.

aggregation_type

String

Statistical mode.

  • average

  • minimum

  • maximum

  • sum

  • sampleCount

operator

String

Operator. Options: >, <, =, >=, and <=.

thresholds

Map<String,String>

Key-value pair. The key indicates the alarm severity while the value indicates the alarm threshold.

aggregation_window

String

Statistical period.

  • 15s

  • 30s

  • 1m

  • 5m

  • 15m

  • 1h

cmdb

CmdbInfo object

CMDB information.

query_match

String

Query filter criteria.

aom_monitor_level

String

Monitoring layer.

aggregate_type

String

Aggregation mode.

  • by: not grouped

  • avg

  • max

  • min

  • sum

Enumeration values:

  • by

  • avg

  • max

  • min

  • sum

metric_statistic_method

String

Metric statistics method to be used when you set Configuration Mode to Select from all metrics during alarm rule setting.

  • single: single metric

  • mix: multi-metric combined operations

Enumeration values:

  • single

  • mix

expression

String

Expression of a combined operation.

mix_promql

String

PromQL of a combined operation.

Table 11 CmdbInfo

Parameter

Type

Description

app_id

String

Application ID.

node_ids

Array of NodeInfo objects

Node information list.

Table 12 NodeInfo

Parameter

Type

Description

node_type

String

Node type.

node_id

String

Node ID.

Table 13 NoDataCondition

Parameter

Type

Description

no_data_timeframe

Integer

Number of periods without data.

no_data_alert_state

String

Status of the threshold rule when the data is insufficient.

  • no_data: A notification indicating insufficient data is sent.

  • alerting: An alarm is triggered.

  • ok: No exception occurs.

  • pre_state: Retain the previous state.

Enumeration values:

  • no_data

  • alerting

  • ok

  • pre_state

notify_no_data

Boolean

Whether to send a notification when data is insufficient.

Table 14 AlarmTags

Parameter

Type

Description

auto_tags

Array of strings

Automatic tag.

custom_tags

Array of strings

Custom tag.

custom_annotations

Array of strings

Alarm annotation.

Table 15 RecoveryCondition

Parameter

Type

Description

recovery_timeframe

Integer

Number of consecutive periods for which the trigger condition is not met to clear an alarm.

Table 16 EventAlarmTemplateSpec

Parameter

Type

Description

alarm_subtype

String

Alarm rule type.

alarm_source

String

Alarm source, for example, CCE.

event_source

String

Event source.

monitor_object_templates

Array of strings

Monitored object template. Currently, only clusterId is supported.

monitor_objects

Array of Map<String,String> objects

List of monitored objects. Key-value pair.

  • event_type: notification type

  • event_severity: alarm severity

  • event_name: event name

  • namespace: namespace

  • clusterId: cluster ID

  • customField: user-defined field

trigger_conditions

Array of EventTriggerCondition objects

Trigger condition.

Table 17 EventTriggerCondition

Parameter

Type

Description

event_name

String

Event name.

trigger_type

String

Trigger mode.

  • immediately: An alarm is triggered immediately if the alarm condition is met.

  • accumulative: An alarm is triggered if the alarm condition is met for a specified number of times.

Enumeration values:

  • immediately

  • accumulative

aggregation_window

Long

Statistical period, in seconds. For example, 3600 indicates one hour. Leave this parameter empty if trigger_type is set to immediately.

operator

String

Operator. Options: >, <, =, >=, and <=. Leave this parameter empty if trigger_type is set to immediately.

thresholds

Map<String,Integer>

Key-value pair. The key indicates the alarm severity while the value indicates the number of accumulated trigger times. Leave this parameter empty if trigger_type is set to immediately.

frequency

String

Event alarm notification frequency. Leave this parameter empty if trigger_type is set to immediately.

  • 0: alarm sent only once

  • 300: every 5 minutes

  • 600: every 10 minutes

  • 900: every 15 minutes

  • 1800: every 30 minutes

  • 3600: every hour

  • 10800: every 3 hours

  • 21600: every 6 hours

  • 43200: every 12 hours

  • 86400: every day

Table 18 Templating

Parameter

Type

Description

list

Array of TemplateInfo objects

Variable list.

Table 19 TemplateInfo

Parameter

Type

Description

name

String

Variable name.

type

String

Variable type.

query

String

Variable value.

description

String

Variable description.

Example Requests

  • Query the alarm template list.

    https://{Endpoint}/v4/{project_id}/alarm-rules-template
  • Query the alarm template whose ID is 12142546931.

    https://{Endpoint}/v4/{project_id}/alarm-rules-template?id=1214****2546****931

Example Responses

Status code: 200

OK: The request is successful.

{
  "alarm_rule_templates" : [ {
    "alarm_rule_template_binding" : { },
    "alarm_rule_template_id" : "130****1802****3121",
    "alarm_rule_template_name" : "aomTemplate",
    "alarm_rule_template_project_id" : "2a47****cca5****8373****1bff****",
    "alarm_rule_template_type" : "statics",
    "alarm_template_spec_list" : [ {
      "alarm_template_spec_items" : [ ],
      "related_cce_clusters" : [ ],
      "related_cloud_service" : "VPC",
      "related_prometheus_instances" : [ ]
    } ],
    "create_time" : 1732266984780,
    "enterprise_project_id" : "0",
    "modify_time" : 1732266984780
  } ],
  "count" : 119
}

Status Codes

Status Code

Description

200

OK: The request is successful.

Error Codes

See Error Codes.