Authored by simba

Merge branch 'master' of http://git.yoho.cn/ops/monitor-ui

... ... @@ -5,14 +5,18 @@ package com.ui.contants;
*/
public class HttpUriContants {
/*** 机组信息 ****/
/***
* 机组信息
****/
public static final String HOST_GROUP_GETALL = "/hostGroup/getHostGroups";
public static final String HOST_GROUP_SAVE = "/hostGroup/saveHostGroup";
public static final String HOST_GROUP_DELETE = "/hostGroup/delHostGroup";
public static final String HOST_ALL_GROUPS = "/hostGroup/getAllGroups";
/*** 机组信息 ****/
/***
* 机组信息
****/
//类型信息
public static String TYPE_GET_ALL = "/type/query";
... ... @@ -22,7 +26,9 @@ public class HttpUriContants {
public static String TYPE_QUERY_NODE = "/type/queryNode";
public static String TYPE_QUERY_JAVAAPI = "/type/queryJavaApi";
/*** 主机信息 ****/
/***
* 主机信息
****/
public static final String GET_HOST_INFOS = "/hostInfo/getHostInfos";
public static final String SAVE_HOST_INFOS = "/hostInfo/saveHostInfo";
... ... @@ -30,7 +36,9 @@ public class HttpUriContants {
public static final String DEL_HOST_INFOS = "/hostInfo/delHostInfo";
public static final String GET_HOST_INFO_BY_ID = "/hostInfo/getHostInfoById";
/*** 主机信息 ****/
/***
* 主机信息
****/
//java服务信息
... ... @@ -38,8 +46,10 @@ public class HttpUriContants {
public static final String JAVA_API_DEL = "/javaApi/del";
public static final String JAVA_API_SAVE = "/javaApi/save";
public static final String JAVA_API_STATUS = "/javaApiStatus/query";
public static final String JAVA_API_HIS = "/javaApiStatus/queryhis";
/*** ZK监控信息查询 ****/
/***
* ZK监控信息查询
****/
public static final String GET_ZK_INFO = "/zkMonitor/getZkMonitorRecords";
}
... ...
... ... @@ -18,7 +18,9 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by fruwei on 2016/6/17.
... ... @@ -88,5 +90,30 @@ public class JavaAPICtrl {
return rep;
}
@RequestMapping("/history")
@ResponseBody
public BaseResponse getHistory(@RequestParam(required = false, defaultValue = "0") int api_id,
@RequestParam(required = false, defaultValue = "0") int mobj_id,
@RequestParam(required = false, defaultValue = "0") long start_time,
@RequestParam(required = false, defaultValue = "0") long end_time,
@RequestParam(required = false, defaultValue = "0") int page) {
Map<String, String> param = new HashMap<String, String>();
param.put("api_id", "" + api_id);
param.put("mobj_id", "" + mobj_id);
param.put("start_time", "" + start_time);
param.put("end_time", "" + end_time);
param.put("page", "" + page);
BaseResponse rep;
try {
rep = httpClient.defaultGet(HttpUriContants.JAVA_API_HIS, BaseResponse.class, param);
} catch (Exception e) {
rep = new BaseResponse(400);
rep.setMessage("list format error");
}
return rep;
}
}
... ...
... ... @@ -27,7 +27,7 @@
</select>
</div>
<div class="input-group" style="float: left;">
<span class="input-group-addon">请求类型:</span>
<span class="input-g roup-addon">请求类型:</span>
<select id="searchApiReqMethod" name="searchApiReqMethod" class="form-control">
<option value="2">ALL</option>
<option value="0">GET</option>
... ...
... ... @@ -5,7 +5,12 @@
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
String id = request.getParameter("id");
String api_id = request.getParameter("api_id");
if (api_id == null)
api_id = "0";
String mobj_id = request.getParameter("mobj_id");
if (mobj_id == null)
mobj_id = "0";
%>
... ... @@ -62,38 +67,64 @@
</style>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div id="info" class="content" >
<div class="form-group">
<label class="col-sm-2">服务名:</label>
<div id="breadcrumb">
<a href="#" title="Go to Home" class="tip-bottom"><i
class="icon-home"></i> Java服务</a> <a href="#" class="current">服务历史信息</a>
</div>
<div class="col-sm-8">
<input type="text" id="apiName" name="apiName" maxlength="30"
size="40"/>
<div class="container-fluid">
<div class="widget-box">
<div class="widget-title">
<h5>Java服务历史</h5>
</div>
<div class="widget-content nopadding">
<div class="widget-title" style="height: 53px;">
<div>
<div class="form-inline" role="form" id="inBoxQueryDiv"
style=" margin-top: 12px;margin-left: 25px;float: left;">
<div class="input-group" style="float: left;">
<span class="input-group-addon">服务名:</span>
<input type="text" id="searchApiName" name="apiName" class="form-control" placeholder=""/>
</div>
<%--<div class="input-group" style="float: left;">--%>
<%--<span class="input-group-addon">服务类型:</span>--%>
<%--<select id="searchApiType" name="searchApiType" class="form-control" placeholder="">--%>
<%--<option value="0">ALL</option>--%>
<%--</select>--%>
<%--</div>--%>
<%--<div class="input-group" style="float: left;">--%>
<%--<span class="input-group-addon">请求类型:</span>--%>
<%--<select id="searchApiReqMethod" name="searchApiReqMethod" class="form-control">--%>
<%--<option value="2">ALL</option>--%>
<%--<option value="0">GET</option>--%>
<%--<option value="1">POST</option>--%>
<%--</select>--%>
<%--</div>--%>
<div class="input-group" style="float: left;">
<span class="input-group-addon">url:</span>
<input type="text" id="searchapiUrl" name="apiUrl" class="form-control" placeholder=""/>
</div>
<%--<button id="searchJavaInfoBtn" class="btn btn-default">搜索</button>--%>
</div>
</div>
</div>
<div class="row">
<div id="infoTable">
</div>
</div>
</div>
</div>
</body>
</html>
<script type="text/javascript">
var api_id =<%=id %>;
var api_id =<%=api_id %>;
var mobj_id =<%=mobj_id %>;
//加载表格
$(function () {
return ;
//加载表格
$("#infoTable").table({
columnAutoWidth: false,
url: contextPath + "/javaApi/queryOne?id" + api_id,
url: contextPath + "/javaApi/history?api_id=" + api_id + "&mobj_id=" + mobj_id,
striped: true,
title: "java服务信息历史",
dataType: "json",
... ... @@ -109,41 +140,61 @@
// refreshJavaAppStatus();
// },
columns: [{
title: "ID",
field: "serviceId",
width: "2%"
}, {
title: "time",
field: "time",
width: "8%"
},
{
title: "IP",
field: "mIp",
width: "10%"
},
{
title: "端口",
field: "mPort",
width: "4%"
},
{
title: "start",
field: "startTime",
width: "14%"
width: "8%"
},
{
title: "end",
title: "响应时间",
field: "endTime",
width: "10%"
width: "8%"
},
{
title: "耗时(ms)",
field: "costTime",
width: "6%"
},
{
title: "是否错误",
title: "status",
field: "isException",
formatter: function (value, rowData, rowIndex) {
if (rowData.status == 0)
return "fail";
else
return "ok";
},
width: "8%"
}, {
title: "Exception",
field: "exception",
width: "4%"
}, {
title: "响应结果",
field: "response",
width: "4%"
title: "Result",
field: "exception",
formatter: function (value, rowData, rowIndex) {
if (rowData.status == 0)
return rowData.exception;
else
return rowData.response;
},
width: "50%"
}]
});
});
</script>
... ...