新建或更新App报警任务。
ServiceName: apmplus_openapi
Region: cn-beijing
X-App-Ids: xxx
Content-Type: application/json
参数 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | SetAppAlarmRule | 接口名称。当前 API 的名称为 SetAppAlarmRule 。 |
Version | String | 是 | 2022-10-12 | 接口版本。当前 API 的版本为 2022-10-12 。 |
参数 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
id | Long | 否 | 1 | 报警规则ID,如果是新建的可以不传。 |
name | String | 是 | task_test | 规则名称。 |
description | String | 否 | alarm for xxx | 规则描述。 |
monitor_type | String | 是 |
| 监控类型。
|
alarm_level | String | 是 |
| 报警级别。
|
check_cycle | Long | 是 | 5 | 监测周期,分钟为单位,瞬时报警请填0。 |
activations | Array of Activation | 否 | - | 多个时间段。 |
filter | Object of FilterCondition | 否 | - | 报警指标筛选条件。 |
group_bys | Array of GroupBy | 否 | - | 报警分组条件。 |
hit_rule | Object of AlarmHitRule | 是 | - | 报警触发条件。 |
notice_conf | Object of AlarmNoticeConf | 是 | - | 通知配置信息。 |
参数 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
activation_start | String | 否 | 08:00 | 全天生效时间起点。24h制,精确到分。例如早上9点是"09:00"。 |
activation_end | String | 否 | 23:00 | 全天生效时间终点。24h制,精确到分。例如晚上9点是"21:00"。 |
参数 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
type | String | 否 |
| 条件类型。
|
dimension | String | 否 | aid | 条件的名称。 |
op | String | 否 |
| 操作符。
|
value | String | 否 | 123456 | 筛选值。 |
values | Array of String | 否 | [123456] | 筛选值,支持多个。 |
sub_conditions | Array of FilterCondition | 否 | - | 子条件。 |
参数 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
dimension | String | 否 | path | 分组名称。 |
参数 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
type | String | 是 |
| 条件类型。
|
hit_rule_type | String | 是 |
| 规则类型。
|
threshold_calculate_type | String | 是 | - | 阈值计算方式,是纯做加减还是做百分比。 |
threshold_value | Double | 是 | 10000 | 报警阈值。 |
op | String | 是 |
| 比较符。
|
indicator | Object of Indicator | 否 | - | 阈值类型参数配置。 |
indicators | Array of Indicator | 否 | - | 同环比类型参数配置。 |
sub_hit_rules | Array of AlarmHitRule | 否 | - | 子规则。 |
参数 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
type | Array of String | 否 |
| 通知类型。
|
lark_web_hooks | Array of String | 否 | - | 增加飞书的webhook链接配置项。 |
dingding_web_hooks | Array of String | 否 | - | 钉钉webhook。 |
wechat_web_hooks | Array of String | 否 | - | 微信webhook。 |
alarm_receives | Array of Candidate | 否 | - | 接收组。 |
参数 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
name | String | 是 | crash_count | 指标定义名称,由GetAppAlarmMetricsConf 接口获取。 |
value | Double | 否 | 10 | 指标值。 |
recently | Long | 是 | 180 | 指标查询时间范围,比如180min。 |
compare_time | Long | 是 |
| 比较时间。
|
start_time | Long | 否 | - | 统计起始时间。 |
end_time | Long | 否 | - | 统计终止时间。 |
参数 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
is_group | Boolean | 否 | true | 是否接收组。 |
user_name | String | 否 | - | 单个用户。 |
String | 否 | - | 群组。 | |
group_name | String | 否 | - | 群组名。 |
group_id | Integer | 否 | 123 | 接收组ID。 |
参数 | 类型 | 示例值 | 描述 |
---|---|---|---|
error_msg | String | - | 错误信息,成功为空。 |
error_no | Long | 0 | 错误码,成功为0。 |
POST https://open.volcengineapi.com?Action=SetAppAlarmRule&Version=2022-10-12
{
"name": "测试报警0401",
"description": "",
"alarm_level": "fatal",
"filter": {
"type": "and",
"sub_conditions": [
{
"dimension": "aid",
"type": "expression",
"op": "in",
"values": [
"123456"
]
}
]
},
"hit_rule": {
"type": "and",
"sub_hit_rules": [
{
"type": "expression",
"hit_rule_type": "threshold",
"indicator": {
"name": "crash_count",
"recently": 180,
"compare_time": 0
},
"threshold_calculate_type": "",
"threshold_value": 1,
"op": "gte"
}
]
},
"check_cycle": 5,
"activations": [
{
"activation_start": "00:00",
"activation_end": "23:59"
}
],
"group_bys": [
{
"dimension": "os"
}
],
"notice_conf": {
"type": [
"lark"
],
"lark_web_hooks": [
"https://open.feishu.cn/open-apis/bot/v2/hook/f135"
]
},
"monitor_type": [
"crash"
],
"id": 12345
}
{
"error_msg": "",
"error_no": 0
}
本接口无特有的错误码。更多信息请参见错误码。