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

GetAppAlarmHistory

最近更新时间2023.12.26 16:39:07

首次发布时间2022.11.18 17:53:52

调用GetAppAlarmHistory接口获取App报警历史。

使用说明

  • 接口名称:GetAppAlarmHistory
  • 请求方式:POST
  • 接口地址:/?Action=GetAppAlarmHistory&Version=2022-10-12

请求参数

Query

参数

类型

是否必选

示例值

描述

Action

String

GetAppAlarmHistory

请求名称。

Version

String

2022-10-12

请求版本。

ServiceName : apmplus_openapi
Region : cn-beijing 
X-App-Ids : xxx
Content-Type : application/json

Body

参数

类型

是否必选

示例值

描述

aid

i64

123456

应用ID。

filters

object of Filter

-

过滤条件。

start_time

i64

1665417600

开始时间

end_time

i64

1666417600

终止时间。

query_key

string

test

报警事件名模糊搜索,不填默认全部。

page_size

i64

2

分页条数,不传默认10。

page_no

i64

1

起始页码为1。

monitor_types

array of string

["crash"]

监控类型。

  • crash:崩溃
  • crash_defend:崩溃防护
  • lag:卡顿
  • flutter_crash:flutter监控
  • app_page_js_err:页面监控/js错误
  • app_page_ajax_err:页面监控/请求错误
  • app_page_perf:页面监控/性能
  • app_event:事件报警
  • net_err:网络错误
  • custom_exception:自定义错误
  • traffic_exception:流量
  • disk_exception:磁盘
  • battery_trace:电量
  • cpu_exception:CPU

order_by

string

-

排序方式,默认按报警时间倒序排列。

Filter

参数

类型

是否必选

示例值

描述

type

string

expression

筛选条件类型。

  • expression:表达式
  • map:映射
  • and:且条件

op

string

in

操作符

  • in:包含

dimension

string

aid

条件的名称。

values

array of string

[123456]

筛选值,支持多个。

value

string

[123456]

筛选值。

map_key

string

key_1

map类型key,当type为map时必填。

sub_conditions

array of Filter

-

子条件。

返回参数

参数

类型

示例值

描述

data

array of data

-

报警历史。

error_msg

string

-

错误信息,成功为空。

error_no

i64

0

错误码,成功为0。

data

参数

类型

示例值

描述

data

array of Data

-

报警历史。

total_cnt

i64

-

总条数。

total_page

i64

-

总页数。

curr_page

i64

-

当前页码。

Data

参数

类型

示例值

描述

id

i64

1

报警ID。

rule_id

i64

1

报警任务ID。

rule_name

string

test

报警名称。

occur_time

string

-

报警事件发生时间。

notify_content

string

-

报警内容。

alarm_level

string

-

报警级别。

  • warning
  • fatal

notify_types

array of string

[mail]

通知方式

handle_status

i64

-

处理状态。

ack_status

i64

0

ACK状态。

  • 0:可确认
  • 1:可重置

ack_time

string

-

ACK时间。

url

string

-

链接。

operators

array of string

-

报警创建人ID列表。

operators_info

array of OperatorsInfo

-

报警创建人具体信息。

filter_info

object of FilterInfo

-

报警任务条件。

monitor_type

string

crash

监控类型。

  • crash:崩溃
  • crash_defend:崩溃防护
  • lag:卡顿
  • flutter_crash:flutter监控
  • app_page_js_err:页面监控/js错误
  • app_page_ajax_err:页面监控/请求错误
  • app_page_perf:页面监控/性能
  • app_event:事件报警
  • net_err:网络错误
  • custom_exception:自定义异常异常类型。

hit_rule

object of HitRule

-

报警任务规则配置。

rule_brief

string

-

报警事件对应的规则的简述。

alarm_receives

array of AlarmReceive

-

报警邮件接收组信息。

OperatorsInfo

参数

类型

示例值

描述

id

i64

1

用户ID。

username

string

test_name

用户名称。

email

string

test@test.com

用户邮箱。

FilterInfo

参数

类型

示例值

描述

type

string

and

条件类型。

  • expression:表达式
  • and:且条件
  • or:或条件

dimension

string

aid

条件的名称。

op

string

in

操作符。

  • in:包含

value

string

123456

筛选值。

values

array of string

[123456]

筛选值,支持多个。

sub_conditions

array of FilterInfo

-

子条件。

HitRule

参数

类型

示例值

描述

type

string

and

条件类型。

  • expression:表达式
  • and:且条件
  • or:或条件

hit_rule_type

string

threshold

规则类型。

  • threshold:阈值
  • compare:同环比

threshold_calculate_type

string

-

阈值计算方式,是纯做加减还是做百分比。

threshold_value

double

10000

报警阈值。

op

string

gt

比较符。

  • gt:>
  • gte:≥
  • lt:<
  • lte:≤
  • eq:=

indicator

object of Indicator

-

阈值类型参数配置。

indicators

array of Indicator

-

同环比类型参数配置。

sub_hit_rules

array of HitRule

-

子规则。

AlarmReceive

参数

类型

示例值

描述

is_group

boolean

true

是否接收组。

user_name

string

test

单个用户的用户名。

email

string

test@test.com

用户邮箱。

group_name

string

test

群组接收组名。

group_id

i32

1

接收组ID。

Indicator

参数

类型

示例值

描述

name

string

crash_count

指标定义名称,由GetAppAlarmMetricsConf接口获取。

value

double

10

指标值。

recently

i64

180

指标查询时间范围 ,比如180min。

compare_time

i64

0

比较时间。

  • 5:前五分钟
  • 0:当前

start_time

i64

-

统计开始时间。

end_time

i64

-

统计结束时间。

请求示例

POST https://open.volcengineapi.com/?Action=GetAppAlarmHistory&Version=2022-10-12 

{
    "aid":123456,
    "start_time":1679155200,
    "end_time":1679295939,
    "filters":{
        "type":"and",
        "sub_conditions":[
            {
                "dimension":"rule_id",
                "type":"expression",
                "op":"in",
                "values":[
                    "717"
                ]
            }
        ]
    },
    "query_key":"",
    "monitor_types":[
        "crash"
    ],
    "page_no":1,
    "page_size":1
}

返回示例

正常返回示例

{
    "err_detail": "",
    "data": {
        "data": [
            {
                "id": 12345,
                "rule_id": 717,
                "rule_name": "测试报警0401",
                "occur_time": "2023-02-13 11:56:48",
                "notify_content": "分组1:操作系统名称:Android\n崩溃次数最近180分钟内>=1,当前值5\n任务间隔:5分钟\n筛选条件:\n",
                "alarm_level": "fatal",
                "notify_types": [
                    "lark"
                ],
                "handle_status": 0,
                "ack_status": 0,
                "ack_time": "2022-04-27 23:57:13",
                "operators": [
                    "1"
                ],
                "operators_info": [
                    {
                        "id": 1,
                        "username": "admin-1",
                        "display_name": "admin-1",
                        "email": "",
                        "head_url": "",
                        "sso_user_id": "",
                        "auth_level": "admin",
                        "title": ""
                    }
                ],
                "filter_info": {
                    "type": "and",
                    "dimension": "",
                    "op": "",
                    "sub_conditions": [
                        {
                            "type": "expression",
                            "dimension": "aid",
                            "op": "in",
                            "values": [
                                "123456"
                            ]
                        }
                    ]
                },
                "rule_brief": "任务间隔:5分钟\n筛选条件:\n报警分组:操作系统名称\n最近180分钟内,崩溃次数 阈值>=1",
                "monitor_type":"crash",
                "hit_rule": {
                    "type": "and",
                    "hit_rule_type": "",
                    "threshold_calculate_type": "",
                    "threshold_value": 0,
                    "op": "",
                    "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",
                            "hit_metric": []
                        }
                    ],
                    "hit_metric": []
                }
            }
        ],
        "total_cnt": 312,
        "total_page": 312,
        "curr_page": 1
    },
    "error_msg": "",
    "error_no": 0
}

异常返回示例

{
    "ResponseMetadata": {
        "RequestId": "20180*****2D30",
        "Action": "GetAppAlarmHistory",
        "Version": "2022-10-12",
        "Service": "***",
        "Region": "cn-north-1",
        "Error": {
            "Code": "200000",
            "Message": "参数异常"
        }
    }
}