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

PCAlarmMetricTrend

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

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

调用PCAlarmMetricTrend接口查看报警指标趋势。

请求说明

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

请求参数

Query

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

Body

参数类型是否必选示例值描述
commonObject of CommonParams-通用参数。
time_filterObject of TimeFilter-时间过滤。
idLong1报警规则ID。

CommonParams

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

TimeFilter

参数类型是否必选示例值描述
end_timeInteger1655971939结束时间。
start_timeInteger1655308800开始时间。
granularityInteger3聚合颗粒度,单位为秒。

返回参数

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

AlarmMetricTrendResponseData

参数类型示例值描述
metric_trendsJSON Map-指标趋势。
参数类型示例值描述
keyStringstart_time指标定义的key。
valueObject of ChartData-指标定义的key对应的value。

ChartData

参数类型示例值描述
fieldsArray of Field-字段列表。
sourceArray of String-字段对应值列表。

Field

参数类型示例值描述
idString进程CPU占用展示名称。
nameString进程CPU占用字段名称。

dataType

String

string

数据类型。

  • string
  • number
  • date

请求示例

POST /?Action=PCAlarmMetricTrend&Version=2022-10-28
{
    "common": {
        "aid": 12345,
        "os": "pc",
        "env": "crash",
        "site_type": ""
    },
    "time_filter": {
        "start_time": 1655308800,
        "end_time": 1655971939,
        "granularity": 3
    },
    "id": 1
}

返回示例

{
    "data": {
        "metric_trends": {
            "进程CPU占用": {
                "fields": [
                    {
                        "id": "date",
                        "dataType": "string",
                        "name": "date"
                    },
                    {
                        "id": "进程CPU占用",
                        "dataType": "number",
                        "name": "进程CPU占用"
                    },
                    {
                        "id": "进程CPU占用阈值报警数",
                        "dataType": "number",
                        "name": "进程CPU占用阈值报警数"
                    }
                ],
                "source": [
                    [
                        "2024-05-06 20:00:00",
                        "0",
                        "0"
                    ],
                    [
                        "2024-05-06 21:00:00",
                        "0",
                        "0"
                    ],
                    [
                        "2024-05-06 22:00:00",
                        "0",
                        "0"
                    ]
                ]
            }
        }
    },
    "errmsg": "",
    "errno": 200
}