调用CreateRule接口创建一个告警策略。
ServiceName : Volc_Observe Region : cn-beijing AccessKey : xxx SecretKey : xxx
参数 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | CreateRule | 接口名称。当前 API 的名称为 CreateRule 。 |
Version | String | 是 | 2018-01-01 | 接口版本。当前 API 的版本为 2018-01-01 。 |
参数 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
RuleName | String | 是 | rule_1 | 告警策略名称。 |
Description | String | 否 | simple desc | 策略描述。 |
RuleType | String | 是 |
| 告警策略的类型。 |
Namespace | String | 是 | VCM_ECS | 此策略的监控指标所属的产品空间。参见云产品监控指标下各产品的Namespace。 |
SubNamespace | String | 是 | Instance | 此策略引用的指标所属的维度。参见云产品监控指标下各产品的SubNamespace。 |
Level | String | 是 |
| 告警级别。
|
Conditions | Array of RuleCondition | 是 |
| 告警条件。 |
OriginalDimensions | JSON Map | 是 | - | 告警资源。 |
EvaluationCount | Integer | 是 | 5 | 连续几次检测达到阈值才告警。 |
EffectStartAt | String | 是 | 00:00 | 策略生效窗口的开始时间。表达方式为HH:MM。 |
EffectEndAt | String | 是 | 23:59 | 策略生效窗口的截止时间。表达方式为HH:MM。 |
EnableState | String | 是 |
| 开启状态。
|
Regions | Array of String | 是 | ['CN'] | 生效的RegionId列表。目前只能填一个RegionId。 |
SilenceTime | Integer | 是 | 5 | 告警发送周期。单位为分钟。支持配置为5、10、15、30、60、180、360、720、1440。 |
Webhook | String | 否 | http://alert.volc.com/callback | 告警发生时回调的地址。限制条件,请参见告警回调使用说明 。 |
WebhookIds | Array of String | 否 | ["1"] | 告警回调ID列表。WebhookIds和Webhook参数二选一,不能同时填写。 |
ConditionOperator | String | 否 |
| 多指标判定条件。
|
RecoveryNotify | Object of RecoveryNotify | 否 | - | 告警恢复通知。 |
AlertMethods | Array of String | 是 |
| 告警策略的通知方式。
|
ContactGroupIds | Array of String | 否 | 1 | 告警通知组ID列表。当AlertMethods参数为Email,Phone,SMS时,ContactGroupIds参数不能为空。 |
MultipleConditions | Boolean | 否 |
| 告警策略是否用多指标。
|
NoData | Object of NoData | 否 | - | 无数据报警。 |
参数 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
MetricName | String | 否 | Instance_CpuBusy | 监控指标的名称。参见云产品监控指标下各产品的MetricName。 |
Statistics | String | 否 |
| 统计方法。目前支持avg、max、min。 |
ComparisonOperator | String | 否 |
| 比较符号。支持普通阈值告警: >、>=、<、<=、!=、= ,以及以下同环比告警:
|
Threshold | String | 否 | 100 | 此指标的判断阈值。 |
MetricUnit | String | 否 |
| 监控指标的单位。参见云产品监控指标下各产品的MetricUnit。 说明 同环比告警,MetricUnit需要填写为"Percent"。 |
参数 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
key | String | 是 | ResourceID | 指标的Dimensions名称,例如:ResourceID、NodeName等。 |
value | Array of String | 是 |
| 指标的Dimension的值,是一个数组。 |
参数 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Enable | Boolean | 否 | true | 是否开启告警恢复通知。默认自动开启。 |
参数 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Enable | Boolean | 否 | true | 是否开启无数据告警。默认关闭。 |
EvaluationCount | Integer | 否 | 10 | 连续几次检测无数据才告警。 |
参数 | 类型 | 示例值 | 描述 |
---|---|---|---|
Data | Array of String | ["1354766247190******"] | 告警策略ID。 |
POST https://open.volcengineapi.com?Action=CreateRule&Version=2018-01-01 ServiceName: Volc_Observe Region: cn-beijing AccessKey: xxx SecretKey: xxx { "RuleName": "testabc", "RuleType": "static", "Namespace": "VCM_ECS", "SubNamespace": "Instance", "Regions": [ "cn-beijing" ], "Conditions": [ { "MetricName": "Instance_CpuBusy", "Statistics": "avg", "ComparisonOperator": ">", "Threshold": "4", "MetricUnit": "Percent" }, { "MetricName": "MemoryUsedUtilization", "Statistics": "avg", "ComparisonOperator": ">", "Threshold": "3", "MetricUnit": "Percent" } ], "EffectStartAt": "00:00", "EffectEndAt": "23:59", "MultipleConditions": true, "Level": "critical", "SilenceTime": 5, "EnableState": "enable", "OriginalDimensions": { "ResourceID": [ "i-123oiuoiu23uiow*****","i-123oiuoiu23uiow*****" ] }, "ConditionOperator": "&&", "EvaluationCount": 1, "WebHook":"http://alert.volc.com/callback", "RecoveryNotify": { "Enable": true } }
{ "ResponseMetadata": { "RequestId": "", "Action": "CreateRule", "Version": "2018-01-01", "Service": "", "Region": "" }, "Result": { "Data": [ "1354766247190******" ] } }
本接口无特有的错误码。更多信息请参见错误码。