获取任务最近一次监测结果数据包含以下两个API接口:
<应用>:概览
<接口地址>:/siteapi/data/sitetask/lasttimecheckinfos
<MySQL>:从库
<请求方式>:GET
<请求类型>:URL参数
<响应类型>:JSON
<请求参数>:
参数名称 | 是否必须 | 类型 | 默认值 | 描述 |
task_id | 是 | int | 无 | 任务编号 |
<请求示例>:
curl -H "token:a3af84f7c1d0d935024ba58b5da78aaa" https://v6-api.jiankongbao.com/siteapi/data/sitetask/lasttimecheckinfos?task_id=64
参数名称 | 数据类型 | 描述 |
cntGroupByResult | Array | 监测点检测结果数量分布 "1": 正常监测点数, "2": 异常监测点数, "total": 有数据的监测点总数 |
cntGroupByIsp | Array | 监测点检测结果按运营商和结果分布 { "name": "电信", "monitorCnt": 监测点数量, "abnormalCnt": 异常监测点结果数量, "normalCnt":正常监测点结果数量 }, |
data | Array | 数据的Key值可以说明含义 { "monitor_id": 1, "monitor_name": "陕西西安电信", "location_name": "西安市", "isp_name": "电信", "isp_id": "1", "monitorIp": "devmonitor.jiankongbao.com", "result": "1", //1-响应正常;2-响应不正常 "resp_time": "215.389", "status": "200 OK" }, “primary_ip”:”102.202.5.20” //响应服务器ip "dns_time": "1.16", "connect_time": "60.01", "process_time": "65.55", "download_time": "0.10", "total_time": "126.82", "size_download": "0.22", "speed_download": "1.75" } }, //HTTP/HTTPS监控任务响应结果 "resp_summary": { "res": "[\"\",\"; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.68.rc1.el6_10.1 <<>> www.sina.com A\",\";; global options: +cmd\",\";; Got answer:\",\";; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27423\",\";; flags: qr rd ra; QUERY: 1, ANSWER: 17, AUTHORITY: 0, ADDITIONAL: 0\",\"\",\";; QUESTION SECTION:\",\";www.sina.com.\\t\\t\\tIN\\tA\",\"\",\";; ANSWER SECTION:\",\"www.sina.com.\\t\\t37\\tIN\\tCNAME\\tus.sina.com.cn.\",\"us.sina.com.cn.\\t\\t25\\tIN\\tCNAME\\twwwus.sina.com.\",\"wwwus.sina.com.\\t\\t25\\tIN\\tCNAME\\tww1.sinaimg.cn.w.alikunlun.com.\",\"ww1.sinaimg.cn.w.alikunlun.com.\\t17 IN\\tA\\t124.239.239.228\",\"ww1.sinaimg.cn.w.alikunlun.com.\\t17 "answerfrom": /// "222.222.222.222", "__sid": 80, "mip": "10.0.1.97" }// DNS监控任务响应结果 |
<响应示例>:
{ "cntGroupByResult": { "1": 1, "2": 0, "total": 1 }, "cntGroupByIsp": [ { "name": "电信", "monitorCnt": 1, "abnormalCnt": 0, "normalCnt": 1 } ], "data": [ { "monitor_id": 11, "monitor_name": "上海市电信", "location_name": "上海", "isp_name": "电信", "isp_id": "1", "monitorIp": "101.227.83.20", "result": "1", "primary_ip":"102.202.5.20", "resp_time": 36.31, "status": "200 OK" "resp_summary": { "dns_time": "1.16", "connect_time": "60.01", "process_time": "65.55", "download_time": "0.10", "total_time": "126.82", "size_download": "0.22", "speed_download": "1.75" } }, ] }
<应用>:任务概览-监测点数据
<接口地址>:/data/sitetask/batchlasttimecheckinfos
<MySQL>: 从库
<请求方式>:GET
<数据类型>:JSON
<响应类型>:JSON
<请求参数>:
参数名称 | 是否必须 | 类型 | 默认值 | 描述 |
task_ids | 是 | string | 无 | 任务id,批量任务id需要逗号隔开,最多支持100个任务 |
<响应数据>:
参数名称 | 数据类型 | 描述 |
data | Array | 返回结果 |
task_id | Int | 任务id |
data_monitor_info | Array | 当下任务的最后一次检测详情 |
monitor_id | int | 监测点id |
result | int | 响应结果1正常2异常 |
resp_time | Int | 响应时间ms |
status | string | 相应状态 |
check_time | String | 检测时间 |
monitor_status | Int | 监测点状态 |
primary_ip | string | Ip
|
resp_summary | array | 响应具体指标 |
dns_time | string | dns解析时间 |
connect_time | string | 连接时间 |
download_time | string | 内容下载时间 |
total_time | String | 总时间 |
size_download | String | 内容下载大小 |
speed_download | string | 内容下载速度 |
process_time | string | 首字节时间 |
loss | string | 丢包率(仅ping任务) |
<响应示例>:
{
"data":[
{
"task_id":"6924512",
"data_monitor_info":[
{
"monitor_id":1,
"result":2,
"resp_time":0,
"status":"404 Not Found",
"check_time":"1605617205",
"monitor_status":1,
"primary_ip":"106.117.244.228",
"resp_summary":{
"dns_time":"6.71",
"connect_time":"13.55",
"download_time":"0.35",
"total_time":"68.04",
"size_download":"2.61",
"speed_download":"42.50",
"process_time":"47.42"
}
},
...
]
},
{
"task_id":"6924519",
"data_monitor_info":[
{
"monitor_id":1,
"result":1,
"resp_time":1,
"status":"302 Move temporarily",
"check_time":"1605617205",
"monitor_status":1,
"primary_ip":"219.136.244.121",
"resp_summary":{
"dns_time":"3.22",
"connect_time":"42.09",
"download_time":"0.11",
"total_time":"189.96",
"size_download":"0.25",
"speed_download":"1.33",
"appconnect_time":"100.97",
"process_time":"43.56"
}
},
...
]
},
{
"task_id":"6924580",
"data_monitor_info":[
]
},
]
}