流量统计增加活跃IPTOP10一个小时内的趋势,增加一个小时内TOP10最大值,增加接口错误处理
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
package com.nis.util.httpclient;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.ConnectException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
@@ -67,7 +68,7 @@ public class HttpClientUtil {
|
||||
* @throws IOException
|
||||
* @throws ClientProtocolException
|
||||
*/
|
||||
public static String get(String url) throws ClientProtocolException, IOException{
|
||||
public static String get(String url) throws Exception{
|
||||
//实例化httpclient
|
||||
CloseableHttpClient httpclient = HttpClients.createDefault();
|
||||
//实例化get方法
|
||||
@@ -75,19 +76,16 @@ public class HttpClientUtil {
|
||||
//请求结果
|
||||
CloseableHttpResponse response = null;
|
||||
String content ="";
|
||||
try {
|
||||
logger.info("流量统计数据请求路径:"+url);
|
||||
//执行get方法
|
||||
response = httpclient.execute(httpget);
|
||||
if(response.getStatusLine().getStatusCode()==HttpStatus.SC_OK){
|
||||
content = EntityUtils.toString(response.getEntity(),"utf-8");
|
||||
logger.debug("获取消息成功,相应内容如下: " + content);
|
||||
logger.info("获取流量统计数据成功,相应内容如下: " + content);
|
||||
}else {
|
||||
logger.error("获取消息失败,相应内容如下: " + content);
|
||||
throw new ConnectException("流量统计服务接口连接错误"+content);
|
||||
}
|
||||
} catch (ClientProtocolException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
logger.info("dashboard图表数据请求路径:"+url);
|
||||
return content;
|
||||
}
|
||||
|
||||
@@ -322,13 +320,13 @@ public class HttpClientUtil {
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws ClientProtocolException, IOException {
|
||||
HttpClientUtil hd = new HttpClientUtil();
|
||||
hd.get("http://10.0.6.115:9200/_sql?sql=select * from dfipportlog-2016-09-07-15 limit 1 10");
|
||||
Map<String,String> map = new HashMap();
|
||||
map.put("id","1");
|
||||
hd.post("http://localhost:8080/springMVC/menu/getChildren.do",map);
|
||||
|
||||
}
|
||||
// public static void main(String[] args) throws ClientProtocolException, IOException {
|
||||
// HttpClientUtil hd = new HttpClientUtil();
|
||||
//// hd.get("http://10.0.6.115:9200/_sql?sql=select * from dfipportlog-2016-09-07-15 limit 1 10");
|
||||
// Map<String,String> map = new HashMap();
|
||||
// map.put("id","1");
|
||||
// hd.post("http://localhost:8080/springMVC/menu/getChildren.do",map);
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.nis.web.controller.dashboard;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -14,12 +16,17 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.beust.jcommander.internal.Maps;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.PageLog;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.configuration.WebsiteDomainTopic;
|
||||
@@ -64,6 +71,7 @@ public class DashboardController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("活跃端口数据错误"+e);
|
||||
list.add(Maps.newHashMap("error","request_service_failed"));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -85,9 +93,88 @@ public class DashboardController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("活跃IP错误"+e);
|
||||
list.add(Maps.newHashMap("error","request_service_failed"));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 活跃IP TOP10 一小时 间隔5分钟数据
|
||||
*/
|
||||
@RequestMapping(value="ipActiveMinuteList")
|
||||
@ResponseBody
|
||||
public List ipActiveMinuteList(){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
try {
|
||||
String string = HttpClientUtil.get("http://127.0.0.1:8082/galaxy/service/log/v1/trafficIpActiveFiveMinute");
|
||||
// String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.TRAFFIC_IPACTIVE);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
||||
logger.info("活跃IP1小时,间隔5分钟数据"+fromJsonList);
|
||||
list = (ArrayList) fromJsonList.get("data");
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("活跃IP数据获取错误"+e);
|
||||
list.add(Maps.newHashMap("error","request_service_failed"));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 活跃IP详情
|
||||
* @param request
|
||||
* @param response
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static Gson getIntGson() {
|
||||
Gson gson = new GsonBuilder()
|
||||
.registerTypeAdapter(
|
||||
new TypeToken<Map<String, Object>>() {
|
||||
}.getType(),
|
||||
new JsonDeserializer<Map<String, Object>>() {
|
||||
@Override
|
||||
public Map<String, Object> deserialize(
|
||||
JsonElement json, Type typeOfT,
|
||||
JsonDeserializationContext context) throws JsonParseException {
|
||||
|
||||
Map<String, Object> treeMap = new HashMap<String, Object>();
|
||||
JsonObject jsonObject = json.getAsJsonObject();
|
||||
Set<Map.Entry<String, JsonElement>> entrySet = jsonObject.entrySet();
|
||||
for (Map.Entry<String, JsonElement> entry : entrySet) {
|
||||
treeMap.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
return treeMap;
|
||||
}
|
||||
}).create();
|
||||
return gson;
|
||||
}
|
||||
@RequestMapping(value="ipActiveList")
|
||||
public String ipActiveList( HttpServletRequest request, HttpServletResponse response, Model model, RedirectAttributes redirectAttributes){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List<TrafficIpActiveStatistic> ipActiveList = new ArrayList<TrafficIpActiveStatistic>();
|
||||
String string;
|
||||
try {
|
||||
string = HttpClientUtil.get("http://127.0.0.1:8082/galaxy/service/log/v1/trafficIpActiveOneHour");
|
||||
// String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.TRAFFIC_IPACTIVE);
|
||||
|
||||
Gson gson = getIntGson();
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map<String, Object>>(){}.getType());
|
||||
logger.info("活跃IP1小时"+fromJsonList);
|
||||
ipActiveList = gson.fromJson(fromJsonList.get("data").toString(), new TypeToken<List<TrafficIpActiveStatistic>>() {}.getType()) ;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("活跃IP统计错误"+e);
|
||||
addMessage(redirectAttributes,"request_service_failed");
|
||||
}
|
||||
|
||||
|
||||
model.addAttribute("ipActiveList", ipActiveList);
|
||||
return "/dashboard/trafficIpActiveList";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 协议统计
|
||||
*/
|
||||
@@ -123,6 +210,7 @@ public class DashboardController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("协议统计错误"+e);
|
||||
resultList.add(Maps.newHashMap("error","request_service_failed"));
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
@@ -161,6 +249,7 @@ public class DashboardController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("app流量分析错误"+e);
|
||||
resultList.add(Maps.newHashMap("error","request_service_failed"));
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
@@ -199,6 +288,7 @@ public class DashboardController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("终端用户-获取操作系统列表错误"+e);
|
||||
resultList.add(Maps.newHashMap("error","request_service_failed"));
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
@@ -250,6 +340,7 @@ public class DashboardController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("终端用户-获取操作系统下浏览器类型错误"+e);
|
||||
resultList.add(Maps.newHashMap("error","request_service_failed"));
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
@@ -288,6 +379,7 @@ public class DashboardController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("终端用户-获取浏览器列表错误"+e);
|
||||
resultList.add(Maps.newHashMap("error","request_service_failed"));
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
@@ -339,6 +431,7 @@ public class DashboardController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("终端用户-获取浏览器下操作系统类型错误"+e);
|
||||
resultList.add(Maps.newHashMap("error","request_service_failed"));
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
@@ -383,6 +476,7 @@ public class DashboardController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("http网站流量分析数据错误:"+e);
|
||||
resultList.add(Maps.newHashMap("error","request_service_failed"));
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
@@ -432,6 +526,7 @@ public class DashboardController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("http某个网站子域名流量统计错误"+e);
|
||||
resultList.add(Maps.newHashMap("error","request_service_failed"));
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
@@ -498,13 +593,14 @@ public class DashboardController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("http网站主题流量分析数据错误:"+e);
|
||||
resultList.add(Maps.newHashMap("error","request_service_failed"));
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value="webTypeList")
|
||||
public String ipActiveList( HttpServletRequest request, HttpServletResponse response, Model model){
|
||||
public String webTypeList( HttpServletRequest request, HttpServletResponse response, Model model){
|
||||
PageLog<TrafficIpActiveStatistic> page = new PageLog<TrafficIpActiveStatistic>(request, response);
|
||||
List list = new ArrayList();
|
||||
for (int i = 1; i < 10; i++) {
|
||||
@@ -637,4 +733,41 @@ public class DashboardController extends BaseController{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("a", 10);
|
||||
map.put("b", "10");
|
||||
map.put("c", 10L);
|
||||
map.put("d", "fsaf");
|
||||
//Gson gson = new Gson();
|
||||
Gson gson = new GsonBuilder()
|
||||
/* .registerTypeAdapter(
|
||||
new TypeToken<Map<String, Object>>() {
|
||||
}.getType(),
|
||||
new JsonDeserializer<Map<String, Object>>() {
|
||||
@Override
|
||||
public Map<String, Object> deserialize(
|
||||
JsonElement json, Type typeOfT,
|
||||
JsonDeserializationContext context) throws JsonParseException {
|
||||
|
||||
Map<String, Object> treeMap = new HashMap<String, Object>();
|
||||
JsonObject jsonObject = json.getAsJsonObject();
|
||||
Set<Map.Entry<String, JsonElement>> entrySet = jsonObject.entrySet();
|
||||
for (Map.Entry<String, JsonElement> entry : entrySet) {
|
||||
treeMap.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
return treeMap;
|
||||
}
|
||||
})*/.create();
|
||||
|
||||
String json = gson.toJson(map);
|
||||
System.out.println(json);
|
||||
|
||||
Map map1 = gson.fromJson(json, Map.class);
|
||||
Map map2 = gson.fromJson(json, new TypeToken<Map<String, Object>>() {
|
||||
}.getType());
|
||||
|
||||
System.out.println(map2.get("c"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,8 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
Double dropConnNum=0d;
|
||||
Double monitorNum=0d;
|
||||
Double loopConnNum=0d;
|
||||
Double liveConnNum=0d;
|
||||
Double newUniConnNum=0d;
|
||||
Double inoctetsNum=0d;
|
||||
Double outoctetsNum=0d;
|
||||
Double bandwidth=0d;
|
||||
@@ -76,6 +78,8 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
monitorNum = (Double) map.get("monitorNum");
|
||||
dropConnNum = (Double) map.get("dropConnNum");
|
||||
loopConnNum = (Double) map.get("loopConnNum");
|
||||
liveConnNum = (Double) map.get("liveConnNum");
|
||||
newUniConnNum = (Double) map.get("newUniConnNum");
|
||||
inoctetsNum = (Double) map.get("inoctets");
|
||||
outoctetsNum = (Double) map.get("outoctets");
|
||||
//单位换算 byte->bit/s
|
||||
@@ -88,6 +92,8 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
m.put("monitorNum", monitorNum);
|
||||
m.put("loopConnNum", loopConnNum);
|
||||
m.put("dropConnNum", dropConnNum);
|
||||
m.put("liveConnNum", liveConnNum);
|
||||
m.put("newUniConnNum", newUniConnNum);
|
||||
|
||||
m.put("bandwidth", bandwidth);
|
||||
m.put("inoctetsNum", inoctetsNum);
|
||||
|
||||
@@ -1220,3 +1220,11 @@ user_manage=Client Account Manage
|
||||
ip_reuse_policy_object=IP Reuse Policy Object
|
||||
area_group_manage=Group Area Manage
|
||||
stream_media_protocol=Stream Media Protocol
|
||||
new_link=New Link
|
||||
active_link=Active Link
|
||||
traffic_ipactive_hour_trend=Active IPTOP10 Trend In Nearly One Hour
|
||||
traffic_ipactive_hour_max=Active IPTOP10 Maximum In Nearly One Hour
|
||||
ip_addr=IP
|
||||
area_id=Area
|
||||
link_num=Link Number
|
||||
stat_time=Statistical Time
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1214,3 +1214,11 @@ user_manage=\u5BA2\u6237\u7AEF\u8D26\u53F7\u7BA1\u7406
|
||||
ip_reuse_policy_object=IP\u590D\u7528\u7B56\u7565\u5BF9\u8C61
|
||||
area_group_manage=\u5206\u7EC4\u5730\u7406\u4FE1\u606F\u7BA1\u7406
|
||||
stream_media_protocol=\u6D41\u5A92\u4F53\u534F\u8BAE
|
||||
new_link=\u65B0\u5EFA
|
||||
active_link=\u6D3B\u8DC3
|
||||
traffic_ipactive_hour_trend=\u6D3B\u8DC3IPTOP10\u8FD1\u4E00\u5C0F\u65F6\u5185\u8D8B\u52BF
|
||||
traffic_ipactive_hour_max=\u6D3B\u8DC3IPTOP10\u8FD1\u4E00\u5C0F\u65F6\u5185\u6700\u5927\u503C
|
||||
ip_addr=IP\u5730\u5740
|
||||
area_id=\u5730\u57DF
|
||||
link_num=\u8FDE\u63A5\u6B21\u6570
|
||||
stat_time=\u7EDF\u8BA1\u65F6\u95F4
|
||||
@@ -104,6 +104,34 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fr_fc">
|
||||
<div class="fl_visual">
|
||||
<i class="fa fa-link"> </i>
|
||||
</div>
|
||||
<div class="fl_fc">
|
||||
<!-- <a href="javacript:;"> -->
|
||||
<p data-original-title="<spring:message code="new_link"/>"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
<!-- 新建链接数 --><spring:message code="new_link"/></p>
|
||||
<p class="numberRun5">0</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="fr_fc">
|
||||
<div class="fl_visual">
|
||||
<i class="fa fa-heartbeat"> </i>
|
||||
</div>
|
||||
<div class="fl_fc">
|
||||
<!-- <a href="javacript:;"> -->
|
||||
<p data-original-title="<spring:message code="active_link"/>"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
<!-- 活跃链接数 --><spring:message code="active_link"/></p>
|
||||
<p class="numberRun6">0</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -114,7 +142,7 @@
|
||||
<div class="main_left fl">
|
||||
<div class="left_1">
|
||||
<div class="main_title">
|
||||
<spring:message code="traffic_ipactive_chart"/> <a href="javascipt:void(0)" onclick="ipActiveList();return false;"><i class="fa fa-refresh"></i></a>
|
||||
<spring:message code="traffic_ipactive_chart"/> <a href="${ctx}/dashboard/ipActiveList"><i class="fa fa-line-chart"></i></a> <a href="javascipt:void(0)" onclick="ipActiveList();return false;"><i class="fa fa-refresh"></i></a>
|
||||
</div>
|
||||
<!-- 活跃IP图 --> <div id="chart_main" style="width:100%;height:400px;"></div>
|
||||
</div>
|
||||
@@ -341,10 +369,10 @@
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
//动态显示数据
|
||||
ajaxinfo();
|
||||
setInterval(function(){
|
||||
ajaxinfo();
|
||||
},20000);
|
||||
// ajaxinfo();
|
||||
// setInterval(function(){
|
||||
// ajaxinfo();
|
||||
// },20000);
|
||||
|
||||
protocolList();//协议统计
|
||||
ipActiveList();//活跃IP
|
||||
@@ -377,6 +405,8 @@ function ajaxinfo(){
|
||||
dataScroll(".numberRun1",Math.floor(data.rejectNum));
|
||||
dataScroll(".numberRun2",Math.floor(data.monitorNum));
|
||||
dataScroll(".numberRun3",Math.floor(data.dropConnNum));
|
||||
dataScroll(".numberRun5",Math.floor(data.newUniConnNum));
|
||||
dataScroll(".numberRun6",Math.floor(data.liveConnNum));
|
||||
var bandwidth=data.bandwidth;
|
||||
var bandwidthK=bandwidth/1024;
|
||||
var bandwidthM=bandwidthK/1024;
|
||||
@@ -430,10 +460,6 @@ function ajaxinfo(){
|
||||
}
|
||||
} */
|
||||
},
|
||||
error: function(data, textStatus, errorThrown){
|
||||
// warning_prompt("获取实时列表数据失败!",1500);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
//动态显示数据
|
||||
@@ -456,18 +482,19 @@ function uaSelectChange(){
|
||||
|
||||
//协议类型统计
|
||||
function protocolList(){
|
||||
|
||||
$.ajax({
|
||||
url: '${ctx}/dashboard/protocol',
|
||||
type : "get" ,
|
||||
dataType:"json",
|
||||
cache:false,async:true,
|
||||
success:function (rs) {
|
||||
if(rs[0].error!=null){
|
||||
top.$.jBox.tip("<spring:message code='request_service_failed'/>", "<spring:message code='info'/>");
|
||||
return;
|
||||
}else{
|
||||
echart_1(rs);
|
||||
},
|
||||
error: function(data, textStatus, errorThrown){
|
||||
// warning_prompt("获取实时列表数据失败!",1500);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
}
|
||||
@@ -480,11 +507,13 @@ function ipActiveList(){
|
||||
dataType:"json",
|
||||
cache:false,async:true,
|
||||
success:function (rs) {
|
||||
if(rs[0].error!=null){
|
||||
top.$.jBox.tip("<spring:message code='request_service_failed'/>", "<spring:message code='info'/>");
|
||||
return;
|
||||
}else{
|
||||
echart_main(rs);
|
||||
},
|
||||
error: function(data, textStatus, errorThrown){
|
||||
// warning_prompt("获取实时列表数据失败!",1500);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
}
|
||||
@@ -515,6 +544,9 @@ function portActiveList(){
|
||||
$("#tbodyDataPort").html("");
|
||||
var n=rs.length;
|
||||
var total=0;
|
||||
if(rs[0].error!=null){
|
||||
$("#tbodyDataPort").prepend("<tr class='frist rowData'><td></td><td style='color:#fff'><spring:message code='request_service_failed'/></td><td></td></tr>");
|
||||
}else{
|
||||
if(n>0){
|
||||
$(rs).each(function(i, itemObj) {
|
||||
total+=itemObj.sum;
|
||||
@@ -529,10 +561,8 @@ function portActiveList(){
|
||||
}else{
|
||||
$("#tbodyDataPort").prepend("<tr class='frist rowData'><td></td><td style='color:#fff'>No Data</td><td></td></tr>");
|
||||
}
|
||||
},
|
||||
error: function(data, textStatus, errorThrown){
|
||||
// warning_prompt("获取实时列表数据失败!",1500);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -545,11 +575,13 @@ function appTypeList(){
|
||||
dataType:"json",
|
||||
cache:false,async:true,
|
||||
success:function (rs) {
|
||||
if(rs[0].error!=null){
|
||||
top.$.jBox.tip("<spring:message code='request_service_failed'/>", "<spring:message code='info'/>");
|
||||
return;
|
||||
}else{
|
||||
echart_3(rs);
|
||||
},
|
||||
error: function(data, textStatus, errorThrown){
|
||||
// warning_prompt("获取实时列表数据失败!",1500);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
}
|
||||
@@ -580,6 +612,9 @@ function systemList(){
|
||||
$("#tbodyData1").html("");
|
||||
rs.reverse();
|
||||
var n=rs.length;
|
||||
if(rs[0].error!=null){
|
||||
$("#tbodyData1").prepend("<tr class='frist rowData'><td></td><td style='color:#fff'><spring:message code='request_service_failed'/></td><td></td></tr>");
|
||||
}else{
|
||||
if(n>0){
|
||||
|
||||
$(rs).each(function(i, itemObj) {
|
||||
@@ -603,10 +638,8 @@ function systemList(){
|
||||
}
|
||||
//终端图-操作系统
|
||||
echart_2(rs);
|
||||
},
|
||||
error: function(data, textStatus, errorThrown){
|
||||
// warning_prompt("获取实时列表数据失败!",1500);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
// 点击操作系统列表右侧显示 浏览器图
|
||||
@@ -624,9 +657,6 @@ function osClick(osType,obj){
|
||||
success:function (rs) {
|
||||
echart_5(rs);
|
||||
},
|
||||
error: function(data, textStatus, errorThrown){
|
||||
// warning_prompt("获取实时列表数据失败!",1500);
|
||||
}
|
||||
});
|
||||
}
|
||||
//点击浏览器列表右侧显示 操作系统图
|
||||
@@ -642,9 +672,6 @@ function bsClick(bsType,obj){
|
||||
success:function (rs) {
|
||||
echart_2(rs);
|
||||
},
|
||||
error: function(data, textStatus, errorThrown){
|
||||
// warning_prompt("获取实时列表数据失败!",1500);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -677,8 +704,10 @@ function browserList() {
|
||||
$("#tbodyData1").html("");
|
||||
rs.reverse();
|
||||
var n=rs.length;
|
||||
if(rs[0].error!=null){
|
||||
$("#tbodyData1").prepend("<tr class='frist rowData'><td></td><td style='color:#fff'><spring:message code='request_service_failed'/></td><td></td></tr>");
|
||||
}else{
|
||||
if(n>0){
|
||||
|
||||
$(rs).each(function(i, itemObj) {
|
||||
var count= itemObj.count;
|
||||
var preCount = itemObj.preCount;
|
||||
@@ -700,10 +729,8 @@ function browserList() {
|
||||
}
|
||||
//终端图-浏览器
|
||||
echart_5(rs);
|
||||
},
|
||||
error: function(data, textStatus, errorThrown){
|
||||
// warning_prompt("获取实时列表数据失败!",1500);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
}
|
||||
@@ -732,6 +759,9 @@ function websiteList() {
|
||||
success:function (rs) {
|
||||
$("#tbodyData2").html("");
|
||||
var n=rs.length;
|
||||
if(rs[0].error!=null){
|
||||
$("#tbodyData2").prepend("<tr class='frist rowData'><td></td><td style='color:#fff'><spring:message code='request_service_failed'/></td><td></td></tr>");
|
||||
}else{
|
||||
if(n>0){
|
||||
$(rs).each(function(i, itemObj) {
|
||||
var tr = "<tr class='frist rowData select-row-tr' onclick='javascript:webClick(\""+itemObj.websiteServiceId+"\",this);return false;'>";
|
||||
@@ -753,10 +783,8 @@ function websiteList() {
|
||||
}
|
||||
//网站统计图
|
||||
echart_4(rs);
|
||||
},
|
||||
error: function(data, textStatus, errorThrown){
|
||||
// warning_prompt("获取实时列表数据失败!",1500);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
//点击http网站列表-显示域名图
|
||||
@@ -774,9 +802,6 @@ function webClick(websiteServiceId,obj){
|
||||
success:function (rs) {
|
||||
echart_6(rs);
|
||||
},
|
||||
error: function(data, textStatus, errorThrown){
|
||||
// warning_prompt("获取实时列表数据失败!",1500);
|
||||
}
|
||||
});
|
||||
}
|
||||
//点击http网站列表-显示域名图
|
||||
@@ -790,9 +815,6 @@ function topicAndDomainList(){
|
||||
//主题域名流量统计图
|
||||
echart_topic_domain(rs);
|
||||
},
|
||||
error: function(data, textStatus, errorThrown){
|
||||
// warning_prompt("获取实时列表数据失败!",1500);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -11,14 +11,14 @@
|
||||
|
||||
<div class="page-content">
|
||||
<div class="theme-panel hidden-xs hidden-sm">
|
||||
<button type="button" class="btn btn-default" onClick="javascript:window.location='${ctx}/dashboard/ipActiveList'"><spring:message code="refresh"/></button>
|
||||
<button type="button" class="btn btn-default" onClick="javascript:window.location='${ctx}/dashboard/logChart'"><spring:message code="back"/></button>
|
||||
</div>
|
||||
<h3 class="page-title">
|
||||
<spring:message code="活跃IP实时统计TOP100"></spring:message>
|
||||
<spring:message code="traffic_ipactive_hour_trend"></spring:message>
|
||||
</h3>
|
||||
<h5 class="page-header"></h5>
|
||||
|
||||
<div id="chart" style="width:100%;height:400px;"></div>
|
||||
<div id="chart" style="width:95%;height:350px;"></div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="portlet">
|
||||
@@ -30,25 +30,26 @@
|
||||
</form:form>
|
||||
</div>
|
||||
<sys:message content="${message}"/>
|
||||
<div class="table-responsive">
|
||||
<table id="contentTable" class="table table-striped table-bordered table-condensed text-nowrap">
|
||||
<h3 class="page-title">
|
||||
<spring:message code="traffic_ipactive_hour_max"></spring:message>
|
||||
</h3>
|
||||
<div class="" align="center">
|
||||
<table id="contentTable"class="table table-striped table-bordered table-condensed text-nowrap">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><spring:message code="chart"/></th>
|
||||
<th><spring:message code="ip_addr"/></th>
|
||||
<th><spring:message code="area_id"/></th>
|
||||
<th><spring:message code="link_num"/></th>
|
||||
<th><spring:message code="c2s_pkt_num"/></th>
|
||||
<th><spring:message code="s2c_pkt_num"/></th>
|
||||
<th><spring:message code="c2s_byte_len"/></th>
|
||||
<th><spring:message code="s2c_byte_len"/></th>
|
||||
<th><spring:message code="c2s_byte_num"/></th>
|
||||
<th><spring:message code="s2c_byte_num"/></th>
|
||||
<th><spring:message code="stat_time"/></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach var="entry" items="${page.list }" varStatus="status">
|
||||
<c:forEach var="entry" items="${ipActiveList }" varStatus="status">
|
||||
<tr>
|
||||
<td><a href="#" onclick="openChart();return false"><i class="fa fa-bar-chart"></i></a></td>
|
||||
<td>${entry.ipAddr }</td>
|
||||
<td>${entry.areaId }</td>
|
||||
<td>${entry.linkNum }</td>
|
||||
@@ -56,7 +57,8 @@
|
||||
<td>${entry.s2cPktNum }</td>
|
||||
<td>${entry.c2sByteLen }</td>
|
||||
<td>${entry.s2cByteLen }</td>
|
||||
<td><fmt:formatDate value="${entry.statTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
|
||||
<td>${entry.statTime }</td>
|
||||
<%-- <td><fmt:formatDate value="${entry.statTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td> --%>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
@@ -68,48 +70,61 @@
|
||||
</div>
|
||||
</div>
|
||||
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/highcharts.js"></script>
|
||||
<%-- <script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/themes/grid.js"></script> --%>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
ipActiveMinuteList()
|
||||
|
||||
});
|
||||
|
||||
function showIpActiveChart(rs){
|
||||
console.log(rs)
|
||||
var data=new Array();
|
||||
var xData=new Array();
|
||||
xData=rs[0].statTime;
|
||||
var series=new Array();
|
||||
$(rs).each(function(i, d) {
|
||||
series.push({
|
||||
name: d.ipAddr,
|
||||
data: d.linkNum
|
||||
});
|
||||
})
|
||||
var chart = Highcharts.chart('chart', {
|
||||
title: {
|
||||
text: 'Traffic IP Active Total'
|
||||
text: null
|
||||
},
|
||||
xAxis: {
|
||||
type:'category',
|
||||
categories: xData,
|
||||
title: {
|
||||
text: 'time',
|
||||
align:'high',
|
||||
},
|
||||
// labels:{
|
||||
// formatter:function(){
|
||||
// if(this.value.length>15){
|
||||
// return '<span>'+this.value.substring(10,20)+"..."+'</span>'
|
||||
// }else{
|
||||
// return this.value
|
||||
// }
|
||||
// },
|
||||
// }
|
||||
|
||||
},
|
||||
yAxis: {
|
||||
title: {
|
||||
text: 'IP'
|
||||
text: 'linkNumber'
|
||||
}
|
||||
},
|
||||
credits:{//是否有highcharts水印
|
||||
enabled:false
|
||||
},
|
||||
legend: {
|
||||
layout: 'vertical',
|
||||
align: 'right',
|
||||
verticalAlign: 'middle'
|
||||
},
|
||||
|
||||
plotOptions: {
|
||||
series: {
|
||||
label: {
|
||||
connectorAllowed: false
|
||||
},
|
||||
pointStart: 2010
|
||||
}
|
||||
},
|
||||
|
||||
series: [{
|
||||
name: 'Installation',
|
||||
data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]
|
||||
}, {
|
||||
name: 'Manufacturing',
|
||||
data: [24916, 24064, 29742, 29851, 32490, 30282, 38121, 40434]
|
||||
}, {
|
||||
name: 'Sales & Distribution',
|
||||
data: [11744, 17722, 16005, 19771, 20185, 24377, 32147, 39387]
|
||||
}, {
|
||||
name: 'Project Development',
|
||||
data: [null, null, 7988, 12169, 15112, 22452, 34400, 34227]
|
||||
}, {
|
||||
name: 'Other',
|
||||
data: [12908, 5948, 8105, 11248, 8989, 11816, 18274, 18111]
|
||||
}],
|
||||
series: series,
|
||||
|
||||
responsive: {
|
||||
rules: [{
|
||||
@@ -127,21 +142,23 @@ $(document).ready(function(){
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function showIpActiveChart(){
|
||||
|
||||
}
|
||||
//活跃IP一小时间隔五分钟统计
|
||||
function ipActiveMinuteList(){
|
||||
|
||||
$.ajax({
|
||||
url: '${ctx}/dashboard/ipActiveMinuteList',
|
||||
type : "get" ,
|
||||
dataType:"json",
|
||||
cache:false,async:true,
|
||||
success:function (rs) {
|
||||
showIpActiveChart(rs);
|
||||
},
|
||||
error: function(data, textStatus, errorThrown){
|
||||
// warning_prompt("获取实时列表数据失败!",1500);
|
||||
}
|
||||
});
|
||||
|
||||
function openChart(){
|
||||
var url = "${ctx}/traffic/showChart";
|
||||
windowOpen(url, "", 900, 600);
|
||||
// lay.open({
|
||||
// type:1,
|
||||
// area:['420px','240px'],
|
||||
// content:''
|
||||
// })
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
@@ -21,12 +21,12 @@ p{
|
||||
display: inline-block;
|
||||
}
|
||||
.data_content .data_info .info_2{
|
||||
width: 60%;
|
||||
width: 70%;
|
||||
height: 110px;
|
||||
}
|
||||
|
||||
.data_content .data_info .fr_fc{
|
||||
width: 155%;
|
||||
width: 100%;
|
||||
height: 110px;
|
||||
border: 1px solid #303030;
|
||||
border-width: 0 1px;
|
||||
@@ -55,7 +55,7 @@ p{
|
||||
}
|
||||
|
||||
.data_content .data_info .info_1{
|
||||
width: 40%;
|
||||
width: 30%;
|
||||
height: 110px;
|
||||
}
|
||||
.data_content .data_info .info_2 .fr_fc:first-child{
|
||||
@@ -82,7 +82,7 @@ p{
|
||||
} */
|
||||
|
||||
.data_content .data_info>div.info_2>.text_2>div{
|
||||
width: 33.333%;
|
||||
width: 20%;
|
||||
position: relative;
|
||||
}
|
||||
.data_content .data_info>div.info_1>div>div,
|
||||
@@ -134,6 +134,18 @@ p{
|
||||
color:#288dce;
|
||||
margin-top: 2.1em;
|
||||
}
|
||||
.data_content .data_info .info_2 .fr_fc .numberRun5{
|
||||
font-weight: 600;
|
||||
font-size: 16px;
|
||||
color:#288dce;
|
||||
margin-top: 2.1em;
|
||||
}
|
||||
.data_content .data_info .info_2 .fr_fc .numberRun6{
|
||||
font-weight: 600;
|
||||
font-size: 16px;
|
||||
color:#288dce;
|
||||
margin-top: 2.1em;
|
||||
}
|
||||
.data_content .data_info .info_2 .fr_fc .numberRun{
|
||||
font-weight: 600;
|
||||
font-size: 16px;
|
||||
@@ -153,9 +165,11 @@ p{
|
||||
margin-top: 0.6px;
|
||||
}
|
||||
.data_content .data_info>div.info_1 .fl_fc .csNum{
|
||||
font-size: 12px;
|
||||
font-size: 11px;
|
||||
color:#337ab7 !important;
|
||||
margin-top: 1px;
|
||||
margin-top: -6px;
|
||||
text-align: center;
|
||||
margin-left: 1.3px;
|
||||
}
|
||||
/* .data_info{
|
||||
float: right;
|
||||
|
||||
Reference in New Issue
Block a user