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

PCAlarmUpdate

最近更新时间2024.05.07 20:48:37

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

调用PCAlarmUpdate接口修改报警。

请求说明

  • 请求方式:POST
  • 请求地址:/?Action=PCAlarmUpdate&Version=2022-10-28
ServiceName : apmplus_openapi
Region : cn-beijing
X-App-Ids : xxx
Content-Type : application/json

请求参数

Query

参数类型是否必选示例值描述
ActionStringPCAlarmUpdate接口名称。当前 API 的名称为 PCAlarmUpdate
VersionString2022-10-28接口版本。当前 API 的版本为 2022-10-28

Body

参数类型是否必选示例值描述
commonObject of CommonParams-通用参数。
alarm_param_listArray of AlarmParam-报警参数。

CommonParams

参数类型是否必选示例值描述
osStringpc系统。
aidLong12345App ID。
envStringcrash环境信息。

AlarmParam

参数类型是否必选示例值描述
idLong1创建时不传,更新时传。
descString新的报警报警说明。
nameStringminitor报警名称。
categoryStringpc_flexible报警类型。

is_close

Integer

1

是否关闭报警。

  • 0:开启
  • 1:关闭

alarm_level

String

Warn

报警级别。

  • Notice
  • Warn
  • Fatal

strategy_op

String

and

多策略关系。

  • and
  • or
alarm_periodObject of AlarmPeriod-报警时间段。
notify_configObject of NotifyConfig-报警通知。
strategy_listArray of AlarmStrategy-报警策略。
category_labelString""报警类型展示名称。
interval_secondsInteger300报警间隔,最短5分钟。

AlarmPeriod

参数类型是否必选示例值描述
end_timeInteger86399报警结束时间,单位秒。
start_timeInteger0报警开始时间,单位秒。

NotifyConfig

参数类型是否必选示例值描述

notify_types

Array of String

["mail"]

报警通知方式。

  • lark
  • mail
  • wechat
  • dingding
notify_groupsArray of Long[1,23]邮件接收组ID列表。
upgrade_groupsArray of Long[1,23]升级邮件接收组ID列表。
notify_lark_webhooksArray of String["http://lark/url"]飞书通知webhook列表。
notify_wechat_webhooksArray of String["http://wechat/url"]企业微信通知webhook列表。
notify_dingding_webhooksArray of String["http://dingding/url"]钉钉通知webhook列表。

AlarmStrategy

参数类型是否必选示例值描述
idString9018754602-1655285699772当新建报警策略的时候前端生成,用于后端画趋势图。
measureObject of FlexMeasure-指标集合。
group_bysArray of FlexGroupBy-报警的分组。
filter_listArray of FlexFilter-过滤条件。
alarm_thresholdDouble10报警阈值。

threshold_cmp_op

String

gt

报警阈值的op。

  • gt
  • gte
  • lt
  • lte
  • abs_gt
  • abs_gte
alarm_window_sizeLong180时间窗口,单位s。

alarm_strategy_type

String

threshold

指标计算策略。

  • 阈值:threshold
  • 同比:cmp_last_n_day
daily_compare_countInteger60同比支持过去x分钟。
alarm_sample_thresholdDouble3样本数量阈值。

FlexMeasure

参数类型是否必选示例值描述
nameString崩溃影响用户数指标名称。

type

String

monomial

指标类型。

  • monomial
  • polynomial
customIdStringxe3ejx98前端用于还原页面。
raw_measure_listArray of FlexRawMeasure-具体查询指标。

FlexGroupBy

参数类型是否必选示例值描述
labelStringOS分组展示名称。
group_by_nameStringos分组维度。

FlexFilter

参数类型是否必选示例值描述
opStringin过滤方式。
valuesArray of String["intel", "Qualcomm"]过滤值。
filter_nameStringcpu用于表明filter的哪个维度。

FlexRawMeasure

参数类型是否必选示例值描述
event_nameStringtest_service_gyf前端传了此参数, 后端没有用到。但是还原图表的时候是从这个字段读的事件名。
filter_listArray of FlexFilter-过滤条件。
measure_nameString"{\"metric\":\"pc_flexible.count\",\"event_dimension\":\"pc_flexible.event_name\",\"event_name\":\"test_service_gyf\"}"具体的指标计算值。

返回参数

参数类型示例值描述
dataStringsuccess返回结果。
errmsgString""错误信息,成功时为空。
errnoInteger200错误码,成功为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"
}