tencent cloud

腾讯云可观测平台

动态与公告
产品动态
产品简介
产品概述
产品优势
基本功能
基本概念
应用场景
使用限制
购买指南
云产品监控
应用性能监控
终端性能监控
前端性能监控
云拨测
Prometheus 监控服务
Grafana 服务
事件总线
云压测
快速入门
监控概览
实例分组
云产品监控
应用性能监控
云拨测
云压测
Prometheus 监控服务
Grafana 服务
创建 Dashboard
事件总线
告警服务
云产品监控
云产品监控指标
控制台操作指南
云服务器监控组件
云产品监控对接 Grafana
故障处理
实践教程
应用性能监控
应用性能监控简介
接入指南
控制台操作指南
实践教程
参考信息
常见问题
终端性能监控
终端性能监控概述
控制台操作指南
接入指南
实践教程
前端性能监控
前端性能监控简介
控制台操作指南
接入指南
常见问题
云拨测
产品简介
控制台操作指南
常见问题
云压测
云压测概述
控制台操作指南
实践教程
JavaScript API 列表
常见问题
Prometheus 监控
Prometheus 监控简介
接入指南
控制台操作指南
实践教程
Terraform
常见问题
Grafana 服务
产品简介
控制台操作指南
Grafana 平台常用功能指引
常见问题
Dashboard
什么是 Dashboard
控制台操作指南
告警管理
控制台操作指南
故障处理
常见问题
事件总线
事件总线简介
控制台操作指南
实践教程
常见问题
报表管理
常见问题
腾讯云可观测平台常见问题
告警服务相关
一般性问题
监控图表相关
云服务器监控组件相关
动态阈值告警相关
云监控对接 Grafana 相关
文档阅读指南
相关协议
应用性能监控服务等级协议
APM 隐私协议
APM 数据处理和安全协议
前端性能监控服务等级协议
终端性能监控服务等级协议
云拨测服务等级协议
Prometheus 监控服务服务等级协议
Grafana 服务服务等级协议
云压测服务等级协议
云压测使用限制
Cloud Monitor Service Level Agreement
词汇表
文档腾讯云可观测平台

CreatePrometheusAlertPolicy

聚焦模式
字号
最后更新时间: 2025-11-13 20:45:03

1. API Description

Domain name for API request: monitor.intl.tencentcloudapi.com.

This API is used to create an alerting rule.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: CreatePrometheusAlertPolicy.
Version Yes String Common Params. The value used for this API: 2018-07-24.
Region No String Common Params. This parameter is not required for this API.
InstanceId Yes String Instance ID
AlertRule Yes PrometheusAlertPolicyItem Alert configuration

3. Output Parameters

Parameter Name Type Description
Id String Alerting rule ID
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Creating an alerting rule

This example shows you how to create an alerting rule.

Input Example

POST / HTTP/1.1
Host: monitor.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreatePrometheusAlertPolicy
<Common request parameters>

{
    "InstanceId": "xx",
    "AlertRule": {
        "Name": "xx",
        "Rules": [
            {
                "Describe": "xx",
                "Name": "xx",
                "For": "xx",
                "Labels": [
                    {
                        "Name": "xx",
                        "Value": "xx"
                    }
                ],
                "Rule": "xx",
                "Template": "xx",
                "Annotations": [
                    {
                        "Name": "xx",
                        "Value": "xx"
                    }
                ]
            }
        ],
        "Notification": {
            "AlertManager": {
                "Url": "xx",
                "ClusterId": "xx",
                "ClusterType": "xx"
            },
            "RepeatInterval": "xx",
            "WebHook": "xx",
            "Enabled": true,
            "PhoneNotifyOrder": [
                1
            ],
            "PhoneInnerInterval": 0,
            "PhoneCircleInterval": 0,
            "NotifyWay": [
                "xx"
            ],
            "ReceiverGroups": [
                1
            ],
            "PhoneArriveNotice": true,
            "PhoneCircleTimes": 0,
            "TimeRangeStart": "xx",
            "Type": "xx",
            "TimeRangeEnd": "xx"
        },
        "TemplateId": "xx",
        "ClusterId": "xx",
        "UpdatedAt": "xx",
        "Id": "xx"
    }
}

Output Example

{
    "Response": {
        "Id": "xx",
        "RequestId": "xx"
    }
}

Example2 Creating an alerting rule, with AlertManager being the alert channel

This example shows you how to create an alerting rule, with AlertManager being the alert channel.

Input Example

POST / HTTP/1.1
Host: monitor.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreatePrometheusAlertPolicy
<Common request parameters>

{
    "InstanceId": "xx",
    "AlertRule": {
        "Name": "xx",
        "Rules": [
            {
                "Describe": "xx",
                "Name": "xx",
                "For": "xx",
                "Labels": [
                    {
                        "Name": "xx",
                        "Value": "xx"
                    }
                ],
                "Rule": "xx",
                "Template": "xx",
                "RuleState": 0,
                "Annotations": [
                    {
                        "Name": "xx",
                        "Value": "xx"
                    }
                ]
            }
        ],
        "Notification": {
            "AlertManager": {
                "Url": "xx",
                "ClusterId": "xx",
                "ClusterType": "xx"
            },
            "RepeatInterval": "xx",
            "WebHook": "xx",
            "Enabled": true,
            "PhoneNotifyOrder": [
                1
            ],
            "PhoneInnerInterval": 0,
            "PhoneCircleInterval": 0,
            "NotifyWay": [
                "xx"
            ],
            "ReceiverGroups": [
                "xx"
            ],
            "PhoneArriveNotice": true,
            "PhoneCircleTimes": 0,
            "TimeRangeStart": "xx",
            "Type": "xx",
            "TimeRangeEnd": "xx"
        },
        "TemplateId": "xx",
        "ClusterId": "xx",
        "UpdatedAt": "xx",
        "Id": "xx"
    }
}

Output Example

{
    "Response": {
        "Id": "alert-xxx",
        "RequestId": "3dfe620f-11b8-4301-b279-1fdadedf7a59"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation.ComponentClientUnpack FailedOperation.ComponentClientUnpack
FailedOperation.Db FailedOperation.Db
FailedOperation.DoTRPCTransferFailed DoTRPCTransferFailed
FailedOperation.KubeClientConf FailedOperation.KubeClientConf
FailedOperation.KubeCommon FailedOperation.KubeCommon
InternalError Internal error.
InternalError.Param InternalError.Param
InternalError.UnexpectedInternal InternalError.UnexpectedInternal
InvalidParameter.Param InvalidParameter.Param
InvalidParameter.PromClusterNotFound InvalidParameter.PromClusterNotFound
InvalidParameter.PromInstanceNotFound InvalidParameter.PromInstanceNotFound
ResourceNotFound The resource is not found.

帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈