有奖征文:轻量对象存储LighthouseCOS用户实践> HOT

1. 接口描述

接口请求域名: monitor.tencentcloudapi.com 。

修改告警策略触发条件

默认接口请求频率限制:20次/秒。

推荐使用 API Explorer
点击调试
API Explorer 提供了在线调用、签名验证、SDK 代码生成和快速检索接口等能力。您可查看每次调用的请求内容和返回结果以及自动生成 SDK 调用示例。

2. 输入参数

以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数

参数名称 必选 类型 描述
Action String 公共参数,本接口取值:ModifyAlarmPolicyCondition。
Version String 公共参数,本接口取值:2018-07-24。
Region String 公共参数,详见产品支持的 地域列表
Module String 模块名,固定值 monitor
示例值:monitor
PolicyId String 告警策略 ID
示例值:policy-hi498gw3h2
ConditionTemplateId Integer 触发条件模板 Id,可不传
示例值:123
Condition AlarmPolicyCondition 指标触发条件
示例值:{ "IsUnionRule": 0, "Rules": [ { "MetricName": "abc", "AggregationDimensions": [ "abc" ], "Period": 0, "AggregateType": "abc", "Operator": "abc", "Value": "abc", "ContinuePeriod": 0, "NoticeFrequency": 0, "IsPowerNotice": 0, "Filter": { "Type": "abc", "Expression": "abc", "Dimensions": "abc" }, "Description": "abc", "Unit": "abc", "RuleType": "abc", "IsAdvanced": 0, "IsOpen": 0, "ProductId": "abc", "ValueMax": 0, "ValueMin": 0, "HierarchicalValue": { "Remind": "abc", "Warn": "abc", "Serious": "abc" } } ], "ComplexExpression": "abc" }
EventCondition AlarmPolicyEventCondition 事件触发条件
示例值:{ "Rules":[ { "MetricName":"abc", "AggregationDimensions":[ "abc" ], "Period":0, "AggregateType":"abc", "Operator":"abc", "Value":"abc", "ContinuePeriod":0, "NoticeFrequency":0, "IsPowerNotice":0, "Filter":{ "Type":"abc", "Expression":"abc", "Dimensions":"abc" }, "Description":"abc", "Unit":"abc", "RuleType":"abc", "IsAdvanced":0, "IsOpen":0, "ProductId":"abc", "ValueMax":0, "ValueMin":0, "HierarchicalValue":{ "Remind":"abc", "Warn":"abc", "Serious":"abc" } } ] }
Filter AlarmPolicyFilter 全局过滤条件
示例值:{ "Type": "abc", "Expression": "abc", "Dimensions": "abc" }
GroupBy.N Array of String 聚合维度列表,指定按哪些维度 key 来做 group by
示例值:[ "abc" ]
LogAlarmReqInfo LogAlarmReq 日志告警创建请求参数信息
示例值:{ "InstanceId": "abc", "Filter": [ { "Key": "abc", "Operator": "abc", "Value": "abc" } ], "AlarmMerge": "abc", "AlarmMergeTime": "abc" }
NoticeIds.N Array of String 模板id,专供prom使用
示例值:["notice-2323"]
Enable Integer 启停状态,0=停用,1=启用
示例值:0
PolicyName String 专供prom策略名称
示例值:"prom-1234"
EbSubject String 事件配置的告警
示例值:{ "source": "apigw.cloud.tencent", // 对应云监控所选 云产品 "type": [

3. 输出参数

参数名称 类型 描述
RequestId String 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。

4. 示例

示例1 编辑告警策略触发条件

编辑告警策略触发条件示例如下

输入示例

POST / HTTP/1.1
Host: monitor.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ModifyAlarmPolicyCondition
<公共请求参数>

{
    "Module": "monitor",
    "PolicyId": "policy-hi498gw3h2",
    "Condition": {
        "IsUnionRule": 1,
        "Rules": [
            {
                "MetricName": "cpu_usage",
                "Period": 60,
                "Operator": "ge",
                "Value": "85",
                "ContinuePeriod": 1,
                "NoticeFrequency": 3600,
                "IsPowerNotice": 0
            }
        ]
    },
    "EventCondition": {
        "Rules": [
            {
                "MetricName": "ping_unreach"
            }
        ]
    }
}

输出示例

{
    "Response": {
        "RequestId": "29ghj2hh-45-h53h234h-23"
    }
}

示例2 test

输入示例

POST / HTTP/1.1
Host: monitor.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ModifyAlarmPolicyCondition
<公共请求参数>

{
    "Module": "abc",
    "PolicyId": "abc",
    "ConditionTemplateId": 0,
    "Condition": {
        "IsUnionRule": 0,
        "Rules": [
            {
                "MetricName": "abc",
                "Period": 0,
                "Operator": "abc",
                "Value": "abc",
                "ContinuePeriod": 0,
                "NoticeFrequency": 0,
                "IsPowerNotice": 0,
                "Filter": {
                    "Type": "abc",
                    "Dimensions": "abc"
                },
                "Description": "abc",
                "Unit": "abc",
                "RuleType": "abc",
                "IsAdvanced": 0,
                "IsOpen": 0,
                "ProductId": "abc",
                "ValueMax": 0,
                "ValueMin": 0,
                "HierarchicalValue": {
                    "Remind": "abc",
                    "Warn": "abc",
                    "Serious": "abc"
                }
            }
        ],
        "ComplexExpression": "abc"
    },
    "EventCondition": {
        "Rules": [
            {
                "MetricName": "abc",
                "Period": 0,
                "Operator": "abc",
                "Value": "abc",
                "ContinuePeriod": 0,
                "NoticeFrequency": 0,
                "IsPowerNotice": 0,
                "Filter": {
                    "Type": "abc",
                    "Dimensions": "abc"
                },
                "Description": "abc",
                "Unit": "abc",
                "RuleType": "abc",
                "IsAdvanced": 0,
                "IsOpen": 0,
                "ProductId": "abc",
                "ValueMax": 0,
                "ValueMin": 0,
                "HierarchicalValue": {
                    "Remind": "abc",
                    "Warn": "abc",
                    "Serious": "abc"
                }
            }
        ]
    },
    "Filter": {
        "Type": "abc",
        "Dimensions": "abc"
    },
    "GroupBy": [
        "abc"
    ],
    "LogAlarmReqInfo": {
        "InstanceId": "abc",
        "Filter": [
            {
                "Key": "abc",
                "Operator": "abc",
                "Value": "abc"
            }
        ],
        "AlarmMerge": "abc",
        "AlarmMergeTime": "abc"
    },
    "NoticeIds": [
        "abc"
    ],
    "Enable": 0,
    "PolicyName": "abc",
    "EbSubject": "abc"
}

输出示例

{
    "Response": {
        "RequestId": "abc"
    }
}

5. 开发者资源

腾讯云 API 平台

腾讯云 API 平台 是综合 API 文档、错误码、API Explorer 及 SDK 等资源的统一查询平台,方便您从同一入口查询及使用腾讯云提供的所有 API 服务。

API Inspector

用户可通过 API Inspector 查看控制台每一步操作关联的 API 调用情况,并自动生成各语言版本的 API 代码,也可前往 API Explorer 进行在线调试。

SDK

云 API 3.0 提供了配套的开发工具集(SDK),支持多种编程语言,能更方便的调用 API。

命令行工具

6. 错误码

以下仅列出了接口业务逻辑相关的错误码,其他错误码详见 公共错误码

错误码 描述
FailedOperation 操作失败。
FailedOperation.DoHTTPTransferFailed 后端服务超时
InternalError 内部错误。
InvalidParameter 参数错误。
InvalidParameterValue 参数取值错误。
ResourceNotFound 资源不存在。
UnsupportedOperation 操作不支持。