You need to enable JavaScript to run this app.
导航

PCUpdateAlarm

最近更新时间2023.12.26 19:24:28

首次发布时间2022.11.15 20:38:48

调用PCUpdateAlarm接口修改报警。

请求参数

Query

参数

类型

是否必选

示例值

描述

Action

String

PCAlarmUpdate

请求名称。

Version

String

2022-10-28

请求版本。

Body

参数

类型

是否必选

示例值

描述

common

object of common

-

通用参数。

alarm_param_list

array of alarm_param_list

[{id: 285, name: "lc测试", desc: "测试报警参数", is_close: 0, category: "pc_crash_sink_chtb",…},…},..]

报警参数。

common

参数

类型

是否必选

示例值

描述

aid

i64

12345

App ID。

env

string

crash

环境信息。

os

string

pc

系统。

alarm_param_list

参数

类型

是否必选

示例值

描述

id

i64

1

创建时不传,更新时传。

name

string

minitor

报警名称。

desc

string

新的报警

报警说明。

is_close

i8

1

是否关闭报警。

  • 0:开启
  • 1:关闭

category

string

pc_flexible

报警类型。

category_label

string

""

报警类型展示名称。

alarm_level

string

Warn

报警级别。

  • Notice
  • Warn
  • Fatal

strategy_list

array of strategy_list

[{id: "5422597736-1653918737621", measure: {type: "monomial",…},…}]

报警策略。

strategy_op

string

and

多策略关系。

  • and
  • or

interval_seconds

i32

300

报警间隔,最短5分钟。

alarm_period

object of alarm_period

-

报警时间段。

notify_config

object of notify_config

-

报警通知。

pct_avoid_spike

object of pct_avoid_spike

-

pct报警参数,当开启pct报警屏蔽时必填。

strategy_list

参数

类型

是否必选

示例值

描述

id

string

9018754602-1655285699772

当新建报警策略的时候前端生成,用于后端画趋势图。

measure

object of measure

-

指标集合。

filter_list

array of filter_list

[{op: "in", filter_name: "os", values: ["1"]}]

过滤条件。

alarm_strategy_type

string

threshold

指标计算策略。

  • 阈值:threshold
  • 同比:cmp_last_n_day

daily_compare_count

i32

60

同比支持过去x分钟。

alarm_threshold

double

10

报警阈值。

threshold_cmp_op

string

gt

报警阈值的op。

  • gt
  • gte
  • lt
  • lte
  • abs_gt
  • abs_gte

alarm_sample_threshold

double

3

样本数量阈值。

alarm_window_size

i64

180

时间窗口,单位s。

group_bys

array of group_bys

[{type: "", group_by_name: "os", label: "OS", group_by_number_terms: null},…]

报警的分组。

sample_metric

object of sample_metric

-

简单指标。

user_metric

object of user_metric

-

自定义指标。

alarm_period

参数

类型

是否必选

示例值

描述

start_time

i32

0

开始时间,单位秒。

end_time

i32

86399

结束时间,单位秒。

notify_config

参数

类型

是否必选

示例值

描述

notify_types

array of string

["mail"]

报警通知方式。

  • lark
  • mail
  • wechat
  • dingding

notify_lark_webhooks

array of string

["http://lark/url"]

飞书通知webhook列表。

notify_groups

array of string

[1,23]

邮件接收组ID列表。

notify_wechat_webhooks

array of string

["http://wechat/url"]

企业微信通知webhook列表。

notify_dingding_webhooks

array of string

["http://dingding/url"]

钉钉通知webhook列表。

upgrade_groups

array of string

[1,23]

升级邮件接收组ID列表。

pct_avoid_spike

参数

类型

是否必选

示例值

描述

pct

i8

10

  • 10:pct10
  • 20:pct20

alarm_threshold

double

10

报警阈值。

measure

参数

类型

是否必选

示例值

描述

type

string

monomial

指标类型。

  • monomial
  • polynomial

raw_measure_list

array of raw_measure_list

[{measure_name: "pc_crash_sink_chtb.user_ratio", filter_list: [], event_name: ""}]

具体查询指标。

name

string

崩溃影响用户数

指标名称。

customId

string

xe3ejx98

前端用于还原页面。

filter_list

参数

类型

是否必选

示例值

描述

op

string

in

过滤方式。

filter_name

string

cpu

用于表明filter的哪个维度。

values

array of string

["intel", "Qualcomm"]

过滤值。

group_bys

参数

类型

是否必选

示例值

描述

group_by_name

string

os

分组维度。

label

string

OS

分组展示名称。

sample_metric

参数

类型

是否必选

示例值

描述

type

string

monomial

指标类型。

  • monomial
  • polynomial

raw_measure_list

array of raw_measure_list

[{measure_name: "pc_crash_sink_chtb.user_ratio", filter_list: [], event_name: ""}]

具体查询指标。

name

string

崩溃影响用户数

指标名称。

customId

string

xe3ejx98

前端用于还原页面。

user_metric

参数

类型

是否必选

示例值

描述

type

string

monomial

指标类型。

  • monomial
  • polynomial

raw_measure_list

array of raw_measure_list

[{measure_name: "pc_crash_sink_chtb.user_ratio", filter_list: [], event_name: ""}]

具体查询指标。

name

string

崩溃影响用户数

指标名称。

customId

string

xe3ejx98

前端用于还原页面。

raw_measure_list

参数

类型

是否必选

示例值

描述

measure_name

string

"{\metric\:\pc_flexible.count\,\event_dimension\:\pc_flexible.event_name\,\event_name\:\test_service_gyf\}"

具体的指标计算值。

filter_list

array of filter_list

[]

过滤条件。

event_name

string

test_service_gyf

前端传了此参数,后端没有用到,但是还原图表的时候是从这个字段读的事件名。

返回参数

参数

类型

示例值

描述

data

string

success

返回结果。

errmsg

string

""

错误信息,成功时为空。

errno

i32

200

错误码,成功为200。

请求示例

POST /?Action=PCAlarmUpdate&Version=2022-10-28 
{
    "common": {
        "aid": 12345,
        "os": "pc",
        "site_type": "",
        "env": "crash"
    },
    "alarm_param_list": [
        {
            "name": "minitor",
            "desc": "新的报警",
            "is_close": 1,
            "category": "pc_flexible",
            "alarm_level": "Warn",
            "strategy_list": [
                {
                    "id": "9018754602-1655285699772",
                    "alarm_strategy_type": "threshold",
                    "alarm_threshold": 10,
                    "threshold_cmp_op": "gt",
                    "alarm_window_size": 180,
                    "group_bys": [
                        {
                            "group_by_name": "os",
                            "label": "OS"
                        }
                    ],
                    "filter_list": [
                        {
                            "op": "in",
                            "filter_name": "cpu",
                            "values": [
                                "intel",
                                "Qualcomm"
                            ]
                        }
                    ],
                    "daily_compare_count": 60,
                    "alarm_sample_threshold": 3
                }
            ],
            "strategy_op": "and",
            "interval_seconds": 300,
            "alarm_period": {
                "start_time": 12,
                "end_time": 86399
            },
            "category_label": "",
            "notify_config": {
                "notify_groups": [
                    1,
                    23
                ],
                "upgrade_groups": [
                    1,
                    23
                ],
                "notify_wechat_webhooks": [
                    "http://wechat/url"
                ],
                "notify_types": [
                    "mail"
                ],
                "notify_lark_webhooks": [
                    "http://lark/url"
                ],
                "notify_dingding_webhooks": [
                    "http://dingding/url"
                ]
            },
            "id": 1
        }
    ]
}

返回示例

正常返回示例

{
    "errmsg": "",
    "errno": 200,
    "data": "success"
}

异常返回示例

{
    "ResponseMetadata": {
        "RequestId": "2018****22D30",
        "Action": "PCAlarmUpdate",
        "Version": "2022-10-28",
        "Service": "***",
        "Region": "cn-north-1",
        "Error": {
            "Code": "200000",
            "Message": "参数异常"
        }
    }
}