查询告警模板列表 - ListAlarmRuleTemplate
功能介绍
该接口用于查询告警模板列表。
调用方法
请参见如何调用API。
授权信息
账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权,具体权限要求请参见权限和授权项。
- 如果使用身份策略授权,需具备如下身份策略权限。
授权项
访问级别
资源类型(*为必须)
条件键
别名
依赖的授权项
aom:alarmRuleTemplate:list
List
-
-
-
-
URI
GET /v4/{project_id}/alarm-rules-template
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
project_id |
是 |
String |
项目ID,可以从控制台获取,也可以从调用API处获取。获取方式请参见:获取项目ID。 |
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
id |
否 |
String |
告警模板id。 |
|
type |
否 |
String |
告警模板类型。
|
请求参数
响应参数
状态码:200
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
alarm_rule_templates |
Array of AlarmRuleTemplateBody objects |
告警模板列表。 |
|
count |
Integer |
告警模板总数。 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
alarm_rule_template_name |
String |
告警模板名称。 |
|
alarm_rule_template_name_en |
String |
告警模板英文名称。 |
|
alarm_rule_template_description |
String |
告警模板描述。 |
|
alarm_rule_template_id |
String |
告警模板id。 |
|
alarm_rule_template_project_id |
String |
项目ID,可以从控制台获取,也可以从调用API处获取。获取方式请参见:获取项目ID。 |
|
alarm_rule_template_type |
String |
告警模板类型
|
|
alarm_rule_template_source |
String |
告警模板来源。 |
|
alarm_rule_template_binding |
Map<String,String> |
告警模板所绑定的告警规则。 |
|
alarm_template_spec_list |
Array of AlarmRuleTemplateSpecWithCloudService objects |
告警模板列表。 |
|
enterprise_project_id |
String |
企业项目id。获取方式请参见:获取企业项目ID。 |
|
create_time |
Long |
创建时间。 |
|
modify_time |
Long |
更新时间。 |
|
templating |
Templating object |
告警模板变量列表。 |
|
template_version |
String |
告警模板版本。 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
related_cloud_service |
String |
关联的云服务。 |
|
related_cce_clusters |
Array of strings |
关联的CCE集群。 |
|
related_prometheus_instances |
Array of strings |
关联的Prom实例。 |
|
alarm_notification |
AlarmNotification object |
通知信息。 |
|
alarm_template_spec_items |
Array of AlarmTemplateSpecItem objects |
告警模板列表。 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
notification_type |
String |
通知类型。
枚举值:
|
|
route_group_enable |
Boolean |
启用告警分组规则。
如果告警触发“notify_triggered”或告警恢复“notify_resolved”都设置为false(即都不进行告警通知),则route_group_enable需设置为false。 枚举值:
|
|
route_group_rule |
String |
告警分组规则名称。
|
|
notification_enable |
Boolean |
是否启用告警通知规则。
如果告警触发“notify_triggered”或告警恢复“notify_resolved”都设置为false(即都不进行告警通知),则notification_enable需设置为false。 |
|
bind_notification_rule_id |
String |
告警行动策略id。
|
|
notify_resolved |
Boolean |
告警解决是否通知。
枚举值:
|
|
notify_triggered |
Boolean |
告警触发是否通知。
枚举值:
|
|
notify_frequency |
Integer |
通知频率
|
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
alarm_template_name |
String |
告警模板下单个告警规则名称。 |
|
alarm_template_name_en |
String |
告警模板下单个告警规则英文名称。 |
|
desc |
String |
告警模板下单个告警规则描述。 |
|
desc_en |
String |
告警模板下单个告警规则英文描述。 |
|
alarm_template_spec_type |
String |
告警模板下单个告警规则类型。 “metric”:指标告警 “event”:事件告警 |
|
metric_alarm_template_spec |
MetricAlarmTemplateSpec object |
指标告警模板。 |
|
event_alarm_template_spec |
EventAlarmTemplateSpec object |
事件告警模板。 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
alarm_subtype |
String |
告警规则类别。 |
|
alarm_source |
String |
告警规则来源云服务:CCE 创建标识。 |
|
monitor_type |
String |
监控类型。 |
|
trigger_conditions |
Array of TemplateTriggerCondition objects |
触发条件。 |
|
no_data_conditions |
Array of NoDataCondition objects |
数据不足条件。 |
|
alarm_tags |
Array of AlarmTags objects |
告警标签。 |
|
recovery_conditions |
RecoveryCondition object |
告警恢复条件。 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
metric_query_mode |
String |
指标查询模式。
枚举值:
|
|
metric_namespace |
String |
指标命名空间。 |
|
metric_name |
String |
指标名称。 |
|
metric_unit |
String |
指标单位。 |
|
metric_labels |
Array of strings |
指标维度。 |
|
promql |
String |
Prometheus语句。 |
|
promql_expr |
String |
Prometheus语句模板。 |
|
trigger_times |
String |
连续周期个数。 |
|
trigger_interval |
String |
检查频率周期。
|
|
trigger_type |
String |
触发频率的类型:
枚举值:
|
|
promql_for |
String |
持续时间。 持续时间范围:
|
|
aggregation_type |
String |
检测规则:
|
|
operator |
String |
判断条件:“>”,“<”,“=”,“>=”,“<=” |
|
thresholds |
Map<String,String> |
键值对形式,键为告警级别,值为告警阈值 |
|
aggregation_window |
String |
统计周期。
|
|
cmdb |
CmdbInfo object |
cmdb信息。 |
|
query_match |
String |
查询筛选条件。 |
|
aom_monitor_level |
String |
监控层级。 |
|
aggregate_type |
String |
聚合方式。
枚举值:
|
|
metric_statistic_method |
String |
当配置方式为全量指标时可选择的指标运算方式。
枚举值:
|
|
expression |
String |
混合运算的表达式。 |
|
mix_promql |
String |
混合运算的promQL。 |
|
alarm_message_template |
String |
通知内容。 |
|
promql_monitor_templates |
String |
Prometheus监控模板。默认为cluster。 |
|
query_param |
String |
|
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
no_data_timeframe |
Integer |
无数据处理连续周期。取值范围为1~5。(当"notify_no_data"为true时,该参数必填,当"notify_no_data"为false时,该参数为空) |
|
no_data_alert_state |
String |
数据不足时,阈值规则的状态。(当"notify_no_data"为true时,该参数必填,当"notify_no_data"为false时,该参数为空)
枚举值:
|
|
notify_no_data |
Boolean |
无数据处理开关。true表示启用无数据处理,false表示关闭无数据处理。 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
auto_tags |
Array of strings |
自动标签。 |
|
custom_tags |
Array of strings |
自定义标签。 |
|
custom_annotations |
Array of strings |
告警标注。 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
recovery_timeframe |
Integer |
告警恢复周期的个数。取值范围为1~3 (如果recovery_timeframe 参数不为空,该参数必填) |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
alarm_subtype |
String |
告警规则类别。 |
|
alarm_source |
String |
告警规则来源云服务:CCE 创建标识。 |
|
event_source |
String |
告警来源。 |
|
monitor_object_templates |
Array of strings |
监控对象模板(创建告警时需要补齐里面的内容)。 |
|
monitor_objects |
Array of Map<String,String> objects |
监控对象列表。键值对形式,键值为:
|
|
trigger_conditions |
Array of EventTriggerCondition objects |
触发条件。 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
event_name |
String |
事件名称。 |
|
trigger_type |
String |
触发方式:
枚举值:
|
|
aggregation_window |
Long |
监控周期。单位为秒,例如 1小时 填“3600”,当trigger_type为“immediately”时 该参数为空,当trigger_type为“accumulative”时 该参数必填。 监控周期范围: 5分钟,20分钟,1小时,4小时,24小时。 |
|
operator |
String |
判断条件:“>”,“<”,“=”,“>=”,“<=”,当trigger_type为“immediately”时 该参数为空。当trigger_type为“accumulative”时 该参数必填。 |
|
thresholds |
Map<String,Integer> |
键值对形式,键为告警级别,值为累计次数,当trigger_type为“immediately”时 累计次数为1。当当trigger_type为“accumulative”时 累计次数范围为1~100 (如果trigger_conditions参数不为空,该参数必填) |
|
frequency |
String |
事件类告警频率。当trigger_type为“immediately”时 值为-1。
|
请求示例
-
查询告警模板列表
https://{Endpoint}/v4/{project_id}/alarm-rules-template -
查询告警模板id为12142546931的告警模板
https://{Endpoint}/v4/{project_id}/alarm-rules-template?id=1214****2546****931
响应示例
状态码:200
OK 请求响应成功。
{
"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
}
状态码
|
状态码 |
描述 |
|---|---|
|
200 |
OK 请求响应成功。 |
错误码
请参见错误码。