[关闭]
@wuxuejun 2018-01-19T07:32:16.000000Z 字数 3525 阅读 1573

又拍云 CDN 实时监控 API 接口

1.API 版本

版本 内容
v1 最近更新时间:2018-1-16 15:24:39

2.实时监控

接口名称 接口地址 功能描述
实时监控查询 /flow/map 查询实时统计监控数据,包括健康度、缓存命中率等

3.接口描述

本接口(/flow/map)用于查询实时(当前 1 分钟之内)统计监控数据,包括健康度、缓存命中率、平均下载速度、平均请求耗时、各地区平均下载速度及详情数据。

请求接口域名:api.upyun.com

使用 GET 发起请求,服务端返回 HTTP 响应结果,URL 格式为:

https://api.upyun.com/flow/map?query_type=bucket&query_value=stringValue

4.输入参数

以下请求参数为接口请求参数,非必选。

参数名称 是否必选 类型 描述
query_type string 查询类型,值为 bucketdomain
query_value string 对应 query_type 的值,例如:cdn.upyun.com

样例

/flow/map?query_type=bucket&query_value=123456789

注意事项:

5.输出参数

参数名称 类型 描述
query_time Object 当前数据查询的区间,当前 1 分钟的 Unix 时间戳
realtime_data Object 实时监控数据,具体内容见下文
speed Object 各地区平均下载速度及详情数据,具体内容见下文

query_time 字段说明

参数名称 类型 描述
start_timestamp string 查询指定起始时间,Unix 时间戳
end_timestamp string 查询指定结束时间,Unix 时间戳

示例:

"query_time": {
"start_timestamp": 1516083480,
"end_timestamp": 1516083480
}

realtime_data 字段说明

参数名称 类型 描述
health_degree Object 健康度
hit_degree Object 缓存命中率
avg_download_speed Object 平均下载时间
avg_time_spend int 平均请求耗时
waf Object waf 拦截攻击次数

health_degree 字段说明

参数名称 类型 描述
avg int 所有请求的平均健康度数据
广电 int 广电健康度
其他 int 其他运营商健康度
联通 int 联通健康度
鹏博士 int 鹏博士健康度
移动 int 移动健康度
电信 int 电信健康嘟嘟
铁通 int 铁通健康度

hit_degree 字段说明

参数名称 类型 描述
avg int 所有请求的平均缓存命中率
广电 int 广电缓存命中率
其他 int 其他运营商缓存命中率
联通 int 联通缓存命中率
鹏博士 int 鹏博士缓存命中率
移动 int 移动缓存命中率
电信 int 电信缓存命中率
铁通 int 铁通缓存命中率

avg_download_speed 字段说明

参数名称 类型 描述
avg int 所有请求的平均下载速度
广电 int 广电平均下载速度
其他 int 其他运营商平均下载速度
联通 int 联通平均下载速度
鹏博士 int 鹏博士平均下载速度
移动 int 移动平均下载速度
电信 int 电信平均下载速度
铁通 int 铁通平均下载速度

waf 字段说明

参数名称 类型 描述
avg int 平均攻击次数
广电 int 广电攻击次数
其他 int 其他运营商攻击次数
联通 int 联通攻击次数
鹏博士 int 鹏博士攻击次数
移动 int 移动攻击次数
电信 int 电信攻击次数
铁通 int 铁通攻击次数

speed 字段说明

参数名称 类型 描述
name string 地区名称
value int 平均下载速度
detail Object 各运营商详细明细数据

detail 字段说明

参数名称 类型 描述
speed int 某运营商平均请求速度
time int 某运营商平均请求耗时
size int 某运营商平均请求内容大小
avg_cnt int 某运营商平均请求次数
avg_total_cnt int 总的平均请求次数

示例:

detail": {
    "联通": {
    "speed": 56132.76,
    "time": 109.45,
    "size": 6143.67,
    "avg_cnt": 0.01
    },
    "avg_total_cnt": 0.01
}

6.错误状态

参数名称 类型 描述
type string 错误类型
error_code string 错误代码
request string 请求方法及地址
field string 用于指示出现参数异常的字段
message string 请求错误描述

错误示例:

{
    "type": "BucketOrDomainIsNotBelongToYou",
    "error_code": "23502",
    "request": "GET /flow/map",
    "field": "undefined",
    "message": "bucket or domain is not belong to you"
}

注意事项:错误代码请参见 全局错误码 文档。

7.请求示例

7.1 输入示例

query_type:bucket
query_value:123456789

7.2 GET 请求

请求地址

GET 请求需要将所有输入参数( 参见上文输入示例 )都加在 URL 后:

https://api.upyun.com/flow/map?query_type=bucket&query_value=123456789

AUTH 验证

将 Access Token 放在 HTTP Header里传递,即可调用需要授权认证的接口:

Authorization: Bearer access_token

注意:access_token 为您获取的 API 访问 token ,请自行获取。参照 token 获取文档。

7.3 返回结果示例

"realtime_data": {
        "health_degree": {
            "avg": 0.99,
            "广电": 1,
            "其他": 1,
            "联通": 0.98,
            "鹏博士": 0.99,
            "移动": 0.99,
            "电信": 0.99,
            "铁通": 1
        },
        "hit_degree": {
            "avg": 0.87,
            "广电": 0.97,
            "其他": 0.33,
            "联通": 0.85,
            "鹏博士": 0.92,
            "移动": 0.88,
            "电信": 0.86,
            "铁通": 0.94
        },
        "avg_download_speed": {
            "avg": 302399.18,
            "广电": 951787.59,
            "其他": 1130389.05,
            "联通": 302273,
            "鹏博士": 1376610.38,
            "移动": 354560.44,
            "电信": 596757.53,
            "铁通": 2031494.69
        },
        "avg_time_spend": 42.87,
        "waf": {
            "avg": {

            },
            "广电": {

            },
            "其他": {

            },
            "联通": {

            },
            "鹏博士": {

            },
            "移动": {

            },
            "电信": {

            },
            "铁通": {

            }
        }
    },

"speed": {
     {
      "name": "福建",
      "value": 26294.88,
      "detail": {
        "联通": {
          "speed": 26294.88,
          "time": 302.69,
          "size": 7959.26,
          "avg_cnt": 0.01
        },
        "移动": {
          "speed": 110972.23,
          "time": 93.06,
          "size": 10326.9,
          "avg_cnt": 0.02
        },
        "铁通": {
          "speed": 314488.55,
          "time": 55.21,
          "size": 17361.62,
          "avg_cnt": 0.87
        },
        "电信": {
          "speed": 368977.02,
          "time": 36.49,
          "size": 13464.71,
          "avg_cnt": 0.08
        },
        "avg_total_cnt": 0.04
      }
   },
   {
      "name": "新疆",
      "value": 42301.03,
      "detail": {
        "联通": {
          "speed": 42301.03,
          "time": 245.24,
          "size": 10373.71,
          "avg_cnt": 0
        },
        "电信": {
          "speed": 237566.62,
          "time": 46.37,
          "size": 11015.35,
          "avg_cnt": 0.03
        },
        "移动": {
          "speed": 1826737.23,
          "time": 8.56,
          "size": 15641.44,
          "avg_cnt": 0.01
        },
        "avg_total_cnt": 0.02
      }
    }
}

"query_time": {
        "start_timestamp": 1516083480,
        "end_timestamp": 1516083480
}
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注