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

PCAlarmRuleList

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

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

调用PCAlarmRuleList接口查看报警列表。

请求说明

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

请求参数

Query

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

Body

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

status

Integer

0

监控状态。

  • 0:status_open
  • 1:status_close

self

Integer

1

管理状态。

  • 0:全部不传
  • 1:我管理的

category_list

Array of String

[pc_crash]

报警类型。

  • pc_flexible
  • pc_crash
keywordStringalarm搜索名称关键字。
page_sizeInteger3每页规则数。
page_numInteger1返回页码号。

CommonParams

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

返回参数

参数类型示例值描述
dataObject of AlarmRuleList-返回内容。
errmsgString""错误信息,成功为空。
errnoInteger200错误码,成功为 200。

AlarmRuleList

参数类型示例值描述
countInteger30报警规则总数。
alarm_rule_listArray of AlarmDetail[ {"alarm_param":{...},"created_by": "root", "updated_by": "root" },...]报警规则列表。

AlarmDetail

参数类型示例值描述
created_byStringzhangsan创建人。
updated_byStringlisi更新人。
alarm_paramObject of AlarmParam{id: 285, name: "lc测试", desc: "测试报警参数", is_close: 0, category: "pc_crash_sink_chtb",…}报警配置。
created_timeLong1667550612创建时间。
updated_timeLong1667550612更新时间。
ack_until_timeLong1667550612ack到期时间。
last_execute_timeLong1668550612上次执行时间。
next_trigger_timeLong1667550612下次触发时间。
num_of_alarm_in_last_one_monthInteger1上个月触发次数。

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\"}"具体的指标计算值。

请求示例

POST /?Action=PCAlarmRuleList&Version=2022-10-28
{
    "common": {
        "aid": 12345,
        "os": "pc",
        "env": "crash",
        "site_type": "nuclear"
    },
    "page_size": 3,
    "page_num": 1,
    "keyword": "alarm",
    "self": 1,
    "status": 250,
    "category_list": [
        "pc_crash"
    ]
}

返回示例

{
    "data": {
        "count": 30,
        "alarm_rule_list": [
            {
                "created_by": "zhangsan",
                "updated_by": "lisi",
                "alarm_param": {
                    "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,
                            "alarm_sample_threshold": 3,
                            "group_bys": [
                                {
                                    "group_by_name": "os",
                                    "label": "OS"
                                }
                            ],
                            "filter_list": [
                                {
                                    "op": "in",
                                    "filter_name": "cpu",
                                    "values": [
                                        "intel",
                                        "Qualcomm"
                                    ]
                                }
                            ],
                            "daily_compare_count": 60
                        }
                    ],
                    "strategy_op": "and",
                    "interval_seconds": 300,
                    "alarm_period": {
                        "start_time": 820,
                        "end_time": 86399
                    },
                    "category_label": "",
                    "notify_config": {
                        "notify_dingding_webhooks": [
                            "http://dingding/url"
                        ],
                        "notify_lark_webhooks": [
                            "http://lark/url"
                        ],
                        "notify_wechat_webhooks": [
                            "http://wechat/url"
                        ],
                        "upgrade_groups": [
                            1,
                            23
                        ],
                        "notify_groups": [
                            1,
                            23
                        ],
                        "notify_types": [
                            "mail"
                        ]
                    },
                    "id": 1
                },
                "created_time": 1667550612,
                "updated_time": 1667550612,
                "ack_until_time": 1667550612,
                "last_execute_time": 1668550612,
                "next_trigger_time": 1667550612,
                "num_of_alarm_in_last_one_month": 1
            }
        ]
    },
    "errmsg": "",
    "errno": 200
}