You need to enable JavaScript to run this app.
导航
ListPresetAlertTemplates
最近更新时间:2025.06.19 14:19:57首次发布时间:2025.06.19 14:19:57
我的收藏
有用
有用
无用
无用

查询预置告警模版列表。

请求说明

  • 请求方式:POST
  • 请求地址:https://open.volcengineapi.com?Action=ListPresetAlertTemplates&Version=2018-01-01

调试

请求参数

参数类型是否必选示例值描述
ActionStringListPresetAlertTemplates接口名称。当前 API 的名称为 ListPresetAlertTemplates
VersionString2018-01-01接口版本。当前 API 的版本为 2018-01-01

Name

String

云服务器告警模版

使用模版名称筛选告警模版。

  • 字符串形式,支持中文、英文大小写和特殊字符。
  • 不能以数字、中划线-,特殊字符开头。
  • 长度限制为 1~128 字符。
NamespacesArray of String["VCM_ECS"]按照模版中的云产品筛选告警模版。详情请参见 云产品监控指标 下各产品的 Namespace
TemplateIdsArray of String["1354766247190******"]按照模版 ID 筛选告警模版。

PageNumber

Integer

1

分页查询参数,用于设置当前页码。默认值为 1。

  • 实际起始位置 = (PageNumber-1) * PageSize
  • 实际终止位置 = PageNumber * PageSize
PageSizeInteger30分页查询参数,用于设置每页行数。默认值为 30。

请求示例

POST https://open.volcengineapi.com?Action=ListPresetAlertTemplates&Version=2018-01-01
Content-Type: application/json
{
    "Name": "云服务器告警模版",
    "Namespaces": [
        "VCM_ECS"
    ],
    "TemplateIds": [
        "1354766247190******"
    ],
    "PageNumber": 1,
    "PageSize": 30
}

返回参数

参数类型示例值描述
DataArray of PresetAlertTemplateVO-告警模版详情。

PresetAlertTemplateVO

参数类型示例值描述
IdString1354766247190******告警模版 ID。
DescriptionStringthis is an alert template demo告警模版描述信息。
NameString云服务器告警模版告警模版名称。
NoDataObject of NoData-无数据告警配置。

Status

Boolean

true

告警模版是否已启用,取值:

  • true:已启用。
  • false:未启用。

NotifyMode

String

rule

告警发送聚合策略。

  • rule:(默认)按照规则聚合。
  • Resource:按照规则和资源聚合。
SilenceTimeInteger5告警通知周期。
TemplateRulesArray of TemplateRuleVO-告警模板中包含的告警规则,包括:告警对象、资源、指标、触发条件等。
RecoveryNotifyObject of RecoveryNotify-告警恢复通知。
AlertNotificationObject of AlertNotificationVO-模版关联的告警通知策略。
AppliedProjectNameStringdefault告警模板生成告警策略所属项目。
CreatedAtString2024-10-08T15:22:30+08:00告警模版的创建时间。
UpdatedAtString2024-10-08T15:22:30+08:00告警模版的更新时间。

NoData

参数类型示例值描述

Enable

Boolean

true

是否开启无数据告警。取值:

  • true:开启无数据告警。
  • false:(默认)关闭无数据告警。

EvaluationCount

Integer

10

无数据告警触发阈值,如果在配置的阈值周期内检测无数据上报,则会触发无数据告警。

  • Enable配置为true时,该字段为必填。
  • 整数形式,取值范围为 3~20。

Level

String

notice

无数据告警级别。取值:

  • critical:严重
  • warning:警告
  • notice:通知

TemplateRuleVO

参数类型示例值描述
NameStringdemo告警规则名称。
NamespaceStringVCM_ECS此模板规则的监控指标所属的云产品。详情请参见 云产品监控指标 下各产品的 Namespace
SubNamespaceStringGPU此模板规则引用的指标所属的维度。详情请参见 云监控指标查询 下各产品的 SubNamespace
AppliedRulesArray of AppliedRulesBasic-关联的告警策略信息。
CheckIntervalInteger1生成的告警规则的执行周期 ,由产品配置决定,单位为分钟。
EvaluationCountInteger1触发告警需要持续的周期。单位为分钟。
LevelConditionsArray of LevelCondition-告警分级。

ConditionOperator

String

&&

多指标判定条件。

  • &&:多个指标同时成立才判定为触发告警
  • ||:任意指标满足条件就判定为触发告警

MultipleConditions

Boolean

ture

告警策略是否用多指标。

  • true:多指标
  • false:单指标(默认)

RecoveryNotify

参数类型示例值描述

Enable

Boolean

true

是否开启告警恢复通知。取值:

  • true:(默认)开启告警恢复通知。
  • false:关闭告警恢复通知。

AlertNotificationVO

参数类型示例值描述
WebhookStringhttps://qyapi.weixin.qq.com/xxxx告警回调 Webhook 地址。

WebhookIds

Array of String

["18913208***4528"]

告警回调 Webhook 回调 ID。
可以调用 ListWebhooks 接口,获取 Webhook 回调 ID。

AlertMethods

Array of String

Phone

告警通知方式,取值:

  • Email:使用邮箱接收告警通知。
  • Phone:使用电话接收告警通知。
  • SMS:使用短信接收告警通知。
  • Webhook:使用 Webhook 接收告警通知。

ContactGroupIds

Array of String

145080093687100****

告警联系组 ID。
可以调用 ListContactGroups 接口,获取联系组 ID。

NotificationId

String

189898***00

通知策略 ID。
可以调用 ListNotifications 接口,获取通知策略 ID。

注意

NotificationIdAlertMethods参数不会同时返回,仅会返回一个。

EffectStartAtString00:00告警通知策略生效的开始时间,格式为HH:MM,例如:00:00。

EffectEndAt

String

23:59

告警通知策略生效的截止时间,格式为HH:MM,例如:23:59。

说明

EffectEndAt时间必须晚于EffectStartAt时间。

AppliedRulesBasic

参数类型示例值描述
IdStringalarm_rule_demo告警策略 ID。
NameString1354766247190******告警策略名称。

LevelCondition

参数类型示例值描述

Level

String

warning

告警通知等级,取值:

  • notice:通知
  • warning:警告
  • critical:严重
  • recovery:恢复
ConditionsArray of RuleCondition-告警分级配置。

RuleCondition

参数类型示例值描述
MetricNameStringInstance_CpuBusy监控指标的名称。详情请参见 云监控指标查询 下各产品的 MetricName

Statistics

String

avg

统计方法,取值:

  • avg:平均值。
  • max:最大值。
  • min:最小值。

说明

统计方法会应用到检测时间段内的数据上。例如,默认每次检测数据的时间跨度是 1 分钟,如果统计方法为 avg,那就是对 1 分钟内的数据取平均值。

ComparisonOperator

String

>

比较符号。支持普通阈值告警: >、>=、<、<=、!=、= ,以及以下同环比告警:

  • last_period_increase_pct:环比上周期上涨
  • last_period_decrease_pct:环比上周起下降
  • last_period_abs_pct:环比上周期上涨或下降
  • last_day_increase_pct:同比昨天同一时段上涨
  • last_day_decrease_pct:同比昨天同一时段下降
  • last_day_abs_pct:同比昨天同一时段上涨或下降
  • last_week_increase_pct:同比上周同一时段上涨
  • last_week_decrease_pct:同比上周同一时段下降
  • last_week_abs_pct:同比上周同一时段上涨或下降

Threshold

String

100

指标阈值。

  • 支持输入正数或 0。
  • 最多支持三位小数。

MetricUnit

String

Percent

监控指标的单位。详情请参见 云监控指标查询 下各产品的 MetricUnit

说明

  • 同环比告警,MetricUnit 需要填写为 "Percent"。
  • MetricUnit 中是否带有 IEC 表示不同的进位:
    • 带有 IEC:进位是 1024
    • 不带 IEC:进位是 1000

返回示例

{
    "ResponseMetadata": {
        "Action": "ListPresetAlertTemplates",
        "Region": "cn-beijing",
        "Service": "Volc_Observe",
        "Version": "2018-01-01",
        "RequestId": "20230604110420****100232280022D31"
    },
    "Result": {
        "Data": [
            {
                "Id": "1354766247190******",
                "Name": "云服务器告警模版",
                "NoData": {
                    "Level": "notice",
                    "Enable": true,
                    "EvaluationCount": 10
                },
                "Status": true,
                "CreatedAt": "2024-10-08T15:22:30+08:00",
                "UpdatedAt": "2024-10-08T15:22:30+08:00",
                "NotifyMode": "rule",
                "Description": "this is an alert template demo",
                "SilenceTime": 5,
                "TemplateRules": [
                    {
                        "Name": "demo",
                        "Namespace": "VCM_ECS",
                        "AppliedRules": [
                            {
                                "Id": "alarm_rule_demo",
                                "Name": "1354766247190******"
                            }
                        ],
                        "SubNamespace": "GPU",
                        "CheckInterval": 1,
                        "EvaluationCount": 1,
                        "LevelConditions": [
                            {
                                "Level": "warning",
                                "Conditions": [
                                    {
                                        "Threshold": "100",
                                        "MetricName": "Instance_CpuBusy",
                                        "MetricUnit": "Percent",
                                        "Statistics": "avg",
                                        "ComparisonOperator": ">"
                                    }
                                ]
                            }
                        ],
                        "ConditionOperator": "&&",
                        "MultipleConditions": false
                    }
                ],
                "RecoveryNotify": {
                    "Enable": true
                },
                "AlertNotification": {
                    "Webhook": "https://qyapi.weixin.qq.com/xxxx",
                    "WebhookIds": [
                        "18913208***4528"
                    ],
                    "AlertMethods": [
                        "Phone"
                    ],
                    "ContactGroupIds": [
                        "145080093687100****"
                    ]
                },
                "EffectStartAt": "00:00",
                "EffectEndAt": "23:59",
                "AppliedProjectName": "default"
            }
        ]
    }
}

错误码

本接口无特有的错误码。更多信息请参见 错误码