URI | /v2/site/reportInterface/${task_id}.json (此接口为report接口的优化版) |
Method | GET |
参数说明 | task_id : 网站监控项目id start_date : 开始日期(年-月-日) end_date : 结束日期(年-月-日) monitor : 监测点 注: 1、start_date和end_date两个参数为可选参数,如果不设置将返回当天的监控数据; 2、monitor为可选参数,不设置默认返回平均数据. 当想返回指定监测点数据时,请指定监测点,多个监测点用半角逗号隔开(最多一次只能指定10个监测点)。 |
结果(json) | { "code": 200, //状态码 "data": { "***": { //监测点 "name": "***", "uprate": { //可用率 "******": { //时间戳 "uprate": "***" }, …… }, "fault": { //故障统计 "count": "***", //故障次数 "0": { //故障列表 "start_time" : "0", //开始时间 "end_time" : "0", //结束时间 "diff_time" : "0", //持续时间 "fault_status" : "0", //故障原因 "fault_cate" : "0" //故障分类 }, …… }, "resptime": { //响应时间统计 "********": { //时间戳 "resptime_max": "***", //最大响应时间 "resptime_avg": "***", //平均响应时间 "resptime_min": "***", //最小响应时间 "resp_download_time": "***", //服务器计算时间 "resp_process_time": "***", //建立连接时间 "resp_connect_time": "***", //域名解析时间 "resp_dns_time": "***" //下载内容时间 }, …… } } } } |
上方为优化版API,以下为旧版API(可继续使用):
URI | /v2/site/report/${task_id}.json |
Method | GET |
参数说明 | task_id : 网站监控项目id start_date : 开始日期(年-月-日) end_date : 结束日期(年-月-日) monitor : 监测点id 注: 1、start_date和end_date两个参数为可选参数,如果不设置将返回当天的监控数据。 2、monitor为可选参数,不设置则默认返回所有监测点的数据,如果只想返回平均数据,将参数设为0。 |
结果(json) | 监测点ID ('0'表示平均)=> { ['name'] //监测点名称 ['resptime']=> //响应时间 { [监测时间]=> { ['resptime_max'] //最大响应时间 ['resptime_avg'] //平均响应时间 ['resptime_min'] //最小响应时间 ['resp_process_time'] //服务器计算时间 ['resp_connect_time'] //建立连接时间 ['resp_dns_time'] //DNS域名解析时间 ['resp_download_time'] //下载内容时间 } } ['uprate'] //可用率统计 [监测时间]=> { ['uprate'] //可用率比例 } ['fault'](当为null表示无故障) //故障统计 { ['count'] //故障次数 [故障列表] { ['start_time'] //故障开始时间 ['end_time'] //故障恢复时间 ['diff_time'] //故障持续时间 ['fault_status'] //故障原因 ['fault_cate'] //故障分类 } } } |
一个例子:
curl -s "https://api.jiankongbao.com/v2/site/report/705431.json?access_token=e1794d5ed925c96f3c6bc13b671be6a869d94037&start_date =2014-6-24&end_date=2014-6-25" 说明:access_token通过获取访问token得到.task_id通过网站监控任务列表得到.
返回结果:
{
"0": {
"name": "平均",
"uprate": {
"1403625600": {
"uprate": "0.00"
},
"1403629200": {
"uprate": "0.00"
},
"1403632800": {
"uprate": "0.00"
},
......
},
"fault": {
"0": {
"start_time": "1403678091",
"end_time": "未结束",
"diff_time": "23分钟",
"fault_status": "不包含匹配内容",
"current_fault_period": "23分钟"
},
"1": {
"start_time": "1403573908",
"end_time": "1403662485",
"diff_time": "24小时36分钟",
"fault_status": "不包含匹配内容",
"current_fault_period": "10小时14分钟"
},
"count": 2
},
"resptime": {
"1403625600": {
"resptime_max": "561.17",
"resptime_avg": "120.21",
"resptime_min": "73.50",
"resp_download_time": "22.43",
"resp_process_time": "30.82",
"resp_connect_time": "19.27",
"resp_dns_time": "47.69"
},
"1403629200": {
"resptime_max": "996.52",
"resptime_avg": "216.51",
"resptime_min": "82.17",
"resp_download_time": "36.35",
"resp_process_time": "50.39",
"resp_connect_time": "38.14",
"resp_dns_time": "91.63"
},
"1403632800": {
"resptime_max": "1020.01",
"resptime_avg": "203.60",
"resptime_min": "70.81",
"resp_download_time": "26.00",
"resp_process_time": "36.24",
"resp_connect_time": "19.78",
"resp_dns_time": "121.58"
},
.....
}
},
"1": {
"name": "西安电信",
"uprate": {
"1403625600": {
"uprate": "0.00"
},
"1403629200": {
"uprate": "0.00"
},
"1403632800": {
"uprate": "0.00"
},
........
},
"fault": {
"0": {
"start_time": "1403678031",
"end_time": "未结束",
"diff_time": "24分钟",
"fault_status": "不包含匹配内容",
"current_fault_period": "24分钟"
},
"1": {
"start_time": "1403664536",
"end_time": "1403664657",
"diff_time": "2分钟",
"fault_status": "无法连接服务器",
"current_fault_period": "2分钟"
},
"2": {
"start_time": "1403573848",
"end_time": "1403662485",
"diff_time": "24小时37分钟",
"fault_status": "不包含匹配内容",
"current_fault_period": "10小时14分钟"
},
"count": 3
},
"resptime": {
"1403625600": {
"resptime_max": "149.69",
"resptime_avg": "105.30",
"resptime_min": "85.91",
"resp_download_time": "39.33",
"resp_process_time": "31.46",
"resp_connect_time": "28.85",
"resp_dns_time": "5.65"
},
"1403629200": {
"resptime_max": "148.25",
"resptime_avg": "103.97",
"resptime_min": "85.44",
"resp_download_time": "38.05",
"resp_process_time": "31.81",
"resp_connect_time": "29.41",
"resp_dns_time": "4.70"
},
"1403632800": {
"resptime_max": "154.81",
"resptime_avg": "104.31",
"resptime_min": "85.23",
"resp_download_time": "38.34",
"resp_process_time": "31.63",
"resp_connect_time": "28.93",
"resp_dns_time": "5.41"
},
........
}
},
........
}