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
| 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. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| id | No | String | Alarm template ID. |
| type | Yes | String | Alarm template type. Default: template. |
Request 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.
|
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| alarm_rule_templates | Array of AlarmRuleTemplateBody objects | Alarm template list. |
| count | Integer | Total number of alarm templates. |
| 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.
|
| 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 | Alarm template list. |
| 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. |
| 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. |
| Parameter | Type | Description |
|---|---|---|
| notification_type | String | Notification type.
Enumeration values:
|
| route_group_enable | Boolean | Whether to enable the alarm grouping rule.
If both notify_triggered and notify_resolved are set to false, route_group_enable must be set to false. Enumeration values:
|
| route_group_rule | String | Alarm grouping rule name.
|
| notification_enable | Boolean | Whether to enable the alarm notification rule.
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.
|
| notify_resolved | Boolean | Whether to send a notification when an alarm is cleared.
Enumeration values:
|
| notify_triggered | Boolean | Whether to send a notification when an alarm is triggered.
Enumeration values:
|
| notify_frequency | Integer | Notification frequency.
|
| 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_alarm_template_spec | MetricAlarmTemplateSpec object | Metric alarm template. |
| event_alarm_template_spec | EventAlarmTemplateSpec object | Event alarm template. |
| 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. |
| Parameter | Type | Description |
|---|---|---|
| metric_query_mode | String | Metric query mode.
Enumeration values:
|
| 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 | String | Prometheus statement template. |
| trigger_times | Integer | Number of consecutive periods. |
| trigger_interval | String | Check interval.
|
| trigger_type | String | Trigger frequency. Options:
Enumeration values:
|
| promql_for | String | Duration. Options:
|
| aggregation_type | String | Detection rule. Options:
|
| operator | String | Comparison 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. Options:
|
| cmdb | CmdbInfo object | CMDB information. |
| query_match | String | Query filter criteria. |
| aom_monitor_level | String | Monitoring layer. |
| aggregate_type | String | Aggregation mode.
Enumeration values:
|
| metric_statistic_method | String | Metric statistics method to be used when you set Configuration Mode to Select from all metrics during alarm rule setting.
Enumeration values:
|
| expression | String | Expression of a combined operation. |
| mix_promql | String | PromQL of a combined operation. |
| alarm_message_template | String | Notification content. |
| promql_monitor_templates | Array of strings | Prometheus monitoring template. Default: cluster. |
| query_param | Object |
|
| Parameter | Type | Description |
|---|---|---|
| app_id | String | Application ID. |
| node_ids | Array of NodeInfo objects | Node information list. |
| Parameter | Type | Description |
|---|---|---|
| no_data_timeframe | Integer | Number of consecutive periods without data. Value range: 1–5. (If notify_no_data is set to true, this parameter is mandatory. If notify_no_data is set to false, leave this parameter blank.) |
| no_data_alert_state | String | Status of the threshold rule when the data is insufficient. (If notify_no_data is set to true, this parameter is mandatory. If notify_no_data is set to false, leave this parameter blank.)
Enumeration values:
|
| notify_no_data | Boolean | Whether to take action when no data is reported. true: Enable the function. false: Disable the function. |
| Parameter | Type | Description |
|---|---|---|
| auto_tags | Array of strings | Automatic tag. |
| custom_tags | Array of strings | Custom tag. |
| custom_annotations | Array of strings | Alarm annotation. |
| Parameter | Type | Description |
|---|---|---|
| recovery_timeframe | Integer | Number of consecutive periods for which the trigger condition is not met to clear an alarm. Value range: 1–3. (If recovery_timeframe is specified, this parameter is mandatory.) |
| 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.
|
| trigger_conditions | Array of EventTriggerCondition objects | Trigger condition. |
| Parameter | Type | Description |
|---|---|---|
| event_name | String | Event name. |
| trigger_type | String | Trigger mode.
Enumeration values:
|
| aggregation_window | Long | Monitoring period. Unit: second. For example, 3600 indicates 1 hour. If trigger_type is set to immediately, leave this parameter blank. If trigger_type is set to accumulative, this parameter is mandatory. Value range: 5 minutes, 20 minutes, 1 hour, 4 hours, or 24 hours. |
| operator | String | Operator. Options: >, <, =, >=, and <=. If trigger_type is set to immediately, leave this parameter blank. If trigger_type is set to accumulative, this parameter is mandatory. |
| thresholds | Map<String,Integer> | Key-value pair. The key indicates the alarm severity while the value indicates the number of accumulated trigger times. If trigger_type is set to immediately, the value is 1. If trigger_type is set to accumulative, the value ranges from 1 to 100. (This parameter is mandatory if trigger_conditions is specified.) |
| frequency | String | Event alarm notification frequency. If trigger_type is set to immediately, the value of this parameter is -1.
|
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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.