1、添加 ntc 流量统计
2、修改监测设置修改页面 进程监测 pid文件,进程搜索关键字的非空校验 3、修改i18n 专用设备 为 串联设备 4、增加代理类,解决前端ajax 跨域问题,之后可能会用
This commit is contained in:
@@ -127,7 +127,8 @@
|
||||
Chart.showLoading({text : "loading..."});
|
||||
var option = {
|
||||
title: {
|
||||
text: title ,left:"49%"
|
||||
text: title ,
|
||||
left:"center"
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
@@ -182,8 +183,10 @@
|
||||
var legengData = data.legend;
|
||||
$.ajax({//ajax请求获取数据
|
||||
type : "POST",
|
||||
url : influxdb.url,
|
||||
crossDomain:true,//请求偏向外域
|
||||
url : "<c:url value='/proxy.do'/>",
|
||||
headers:{
|
||||
realurl:influxdb.url
|
||||
},
|
||||
data:{
|
||||
db:data.db,//查询的数据库名
|
||||
q:data.q //查询语句
|
||||
|
||||
248
WebRoot/page/detection/monitorData/ntc.jsp
Normal file
248
WebRoot/page/detection/monitorData/ntc.jsp
Normal file
@@ -0,0 +1,248 @@
|
||||
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
|
||||
<%@ taglib uri="/jstl/c" prefix="c"%>
|
||||
<%@ taglib uri="/jstl/fn" prefix="fn"%>
|
||||
<%@ taglib uri="/jstl/fmt" prefix="fmt"%>
|
||||
<%
|
||||
String path = request.getContextPath();
|
||||
String basePath = request.getScheme() + "://"
|
||||
+ request.getServerName() + ":" + request.getServerPort()
|
||||
+ path + "/";
|
||||
request.setAttribute("vEnter","\n");
|
||||
%>
|
||||
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>NTC</title>
|
||||
<link href="<c:url value='/css/nms.css'/>" rel="stylesheet" type="text/css" />
|
||||
<script language="javascript" type="text/javascript" src="<c:url value='/js/jquery1.11.3.js'/>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<c:url value='/js/echarts.min.js'/>"></script>
|
||||
</head>
|
||||
<style>
|
||||
.section{
|
||||
margin: 30px 10px 30px 10px;
|
||||
float: left;
|
||||
width:100%;
|
||||
}
|
||||
.part{
|
||||
height: 400px;
|
||||
width: 50%;
|
||||
float: left;
|
||||
min-width: 600px;
|
||||
margin-top: 60px;
|
||||
}
|
||||
#template{
|
||||
display: none;
|
||||
}
|
||||
.addr{
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
font-weight:bold;
|
||||
padding: 5px;
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
}
|
||||
.pic{
|
||||
float: left;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
<script language="javascript" type="text/javascript">
|
||||
var systemId = "${systemLogin}";//从session 中取出 systemId
|
||||
var refreshInterval = 30000;//定时数据间隔,单位:ms
|
||||
//数据源
|
||||
var influxdbSource = {
|
||||
"100000":{
|
||||
addr:"Astana",
|
||||
url:'http://10.0.5.19:8086/query'
|
||||
},
|
||||
"100001":{
|
||||
addr:"Almaty",
|
||||
url:"http://10.0.5.15:8086/query"
|
||||
}
|
||||
};
|
||||
//配置查询相关信息
|
||||
var queryInfo = {
|
||||
traffic : {
|
||||
title:'Throughputs (Gigabits per second)',
|
||||
//yAxisName:'packet/s',
|
||||
data: {
|
||||
legend:['Ether','TCP','UDP','IPv4','IPv6'],
|
||||
db:'ntc_stat',
|
||||
q:'SELECT sum("value_sum") /(1024*1024*1024)/30 FROM "[sapp]Ethernet_bps" WHERE time >= now() - 6h GROUP BY time(30s) fill(null);SELECT sum("value_sum") /(1024*1024*1024)/30 FROM "[sapp]TCP_bps" WHERE time >= now() - 6h GROUP BY time(30s) fill(null);SELECT sum("value_sum") /(1024*1024*1024)/30 FROM "[sapp]UDP_bps" WHERE time >= now() - 6h GROUP BY time(30s) fill(null);SELECT sum("value_sum") /(1024*1024*1024)/30 FROM "[sapp]IPv4_bps" WHERE time >= now() - 6h GROUP BY time(30s) fill(null);SELECT sum("value_sum") /(1024*1024*1024)/30 FROM "[sapp]IPv6_bps" WHERE time >= now() - 6h GROUP BY time(30s) fill(null);SELECT sum("value") /(1024*1024*1024)/30 FROM "[sapp]Unknown" WHERE time >= now() - 6h GROUP BY time(30s) fill(null)'
|
||||
}
|
||||
},
|
||||
packet :{
|
||||
title:'Throughputs (Packets per second)',
|
||||
//yAxisName:'conn/s',
|
||||
data:{
|
||||
legend:['TCP','UDP','Ether','IPv4','IPv6'],
|
||||
db:'ntc_stat',
|
||||
q:'SELECT sum("value_sum") /30 FROM "[sapp]TCP_pps" WHERE time >= now() - 6h GROUP BY time(30s) fill(null);SELECT sum("value_sum") /30 FROM "[sapp]UDP_pps" WHERE time >= now() - 6h GROUP BY time(30s) fill(null);SELECT sum("value_sum") /30 FROM "[sapp]Ethernet_pps" WHERE time >= now() - 6h GROUP BY time(30s) fill(null);SELECT sum("value_sum") /30 FROM "[sapp]IPv4_pps" WHERE time >= now() - 6h GROUP BY time(30s) fill(null);SELECT sum("value_sum") /30 FROM "[sapp]IPv6_pps" WHERE time >= now() - 6h GROUP BY time(30s) fill(null)'
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
function renderChart(systemId){
|
||||
var influxdb = influxdbSource[systemId];
|
||||
var addr = influxdb.addr;
|
||||
var $templateClone = $("#template").clone();
|
||||
$templateClone.attr("id",systemId);
|
||||
$templateClone.find(".addr").html(addr);
|
||||
$("#container").append($templateClone);
|
||||
$.each(queryInfo,function(key,info){
|
||||
var $part = $templateClone.find("."+key);
|
||||
var title = info.title;
|
||||
var data = info.data;
|
||||
var yAxisName = info.yAxisName;
|
||||
var legengData = data.legend;
|
||||
var series = [];
|
||||
$.each(legengData,function(i,n){
|
||||
series.push({
|
||||
name: n,
|
||||
symbol:"none",
|
||||
type: 'line',
|
||||
data: []
|
||||
});
|
||||
});
|
||||
var Chart=echarts.init($part[0]);//初始化
|
||||
Chart.showLoading({text : "loading..."});
|
||||
var option = {
|
||||
title: {
|
||||
text: title ,
|
||||
left:"center"
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
formatter: function(params){
|
||||
var dateTime ;
|
||||
var result = "";
|
||||
$.each(params,function(i,n){
|
||||
console.log(n);
|
||||
if(!dateTime){
|
||||
dateTime = (new Date(n.value[0])).Format("yyyy-MM-dd hh:mm:ss");//n.value[0];
|
||||
}
|
||||
result += "<br/>" +n.marker + n.seriesName +": " + (n.value[1]?n.value[1].toFixed(0):"");
|
||||
});
|
||||
return dateTime + result;
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
data:legengData,
|
||||
left:20,
|
||||
bottom:5
|
||||
},
|
||||
xAxis: {
|
||||
type: 'time',
|
||||
timeFormat: 'hh:mm',
|
||||
splitNumber:6
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
name:yAxisName,
|
||||
nameLocation:"middle",
|
||||
nameTextStyle:{
|
||||
padding:30
|
||||
}
|
||||
},
|
||||
series: series
|
||||
};
|
||||
Chart.setOption(option);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//刷新数据
|
||||
function refreshData(){
|
||||
$("#container > .section").each(function(i,n){
|
||||
var $section = $(this);
|
||||
var systemId = $section.attr("id");
|
||||
var influxdb = influxdbSource[systemId];
|
||||
$.each(queryInfo,function(key,info){
|
||||
var $part = $section.find("."+key);
|
||||
var title = info.title;
|
||||
var data = info.data;
|
||||
var legengData = data.legend;
|
||||
$.ajax({//ajax请求获取数据
|
||||
type : "POST",
|
||||
url : influxdb.url,
|
||||
data:{
|
||||
db:data.db,//查询的数据库名
|
||||
q:data.q //查询语句
|
||||
},
|
||||
dataType : "json",
|
||||
success : function(data) {
|
||||
var results = data.results;//返回的result为json格式的数据
|
||||
var series = [];
|
||||
$.each(results, function(index, result) {
|
||||
var s = result["series"];
|
||||
var values = s ? s[0].values : [];
|
||||
series.push({
|
||||
name: legengData[index],
|
||||
type: 'line',
|
||||
data: values
|
||||
});
|
||||
});
|
||||
var Chart=echarts.getInstanceByDom($part[0]);//获取echarts实例
|
||||
Chart.showLoading({text : "loading..."});
|
||||
var option = { series: series };
|
||||
Chart.setOption(option);
|
||||
Chart.hideLoading();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$(function(){
|
||||
if(systemId == '-1'){//显示所有地区的图表
|
||||
$.each(influxdbSource,function(key,value){
|
||||
renderChart(key);
|
||||
});
|
||||
}else{//只显示当前登录的图表
|
||||
renderChart(systemId);
|
||||
}
|
||||
//首次加载数据
|
||||
refreshData();
|
||||
//定时刷新功能
|
||||
setInterval(function(){
|
||||
refreshData();
|
||||
}, refreshInterval);
|
||||
});
|
||||
|
||||
// 对Date的扩展,将 Date 转化为指定格式的String
|
||||
// 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
|
||||
// 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
|
||||
// 例子:
|
||||
// (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
|
||||
// (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
|
||||
Date.prototype.Format = function(fmt) { //author: meizz
|
||||
var o = {
|
||||
"M+" : this.getMonth()+1, //月份
|
||||
"d+" : this.getDate(), //日
|
||||
"h+" : this.getHours(), //小时
|
||||
"m+" : this.getMinutes(), //分
|
||||
"s+" : this.getSeconds(), //秒
|
||||
"q+" : Math.floor((this.getMonth()+3)/3), //季度
|
||||
"S" : this.getMilliseconds() //毫秒
|
||||
};
|
||||
if(/(y+)/.test(fmt))
|
||||
fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
|
||||
for(var k in o)
|
||||
if(new RegExp("("+ k +")").test(fmt))
|
||||
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
|
||||
return fmt;
|
||||
}
|
||||
</script>
|
||||
<body>
|
||||
<div id="container" class="container"></div>
|
||||
<div id="template" class="section" >
|
||||
<div class="addr"></div>
|
||||
<div class="pic">
|
||||
<div class="part traffic"></div>
|
||||
<div class="part packet"></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -104,31 +104,33 @@
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
if(Number(type) ==8){
|
||||
if(Number(type)==8){
|
||||
if(Number(type) > 7 && startType == 0){ // 手动启动
|
||||
if(false ==(
|
||||
$id("processFile","","i18n_udsi.message.processFile_n81i")
|
||||
&& $id("processSearchCode","","i18n_udsi.text.processSearchCode_n81i")
|
||||
$id("processFile","","i18n_adsi.message.processFile_n81i")
|
||||
|| $id("processSearchCode","","i18n_adsi.message.processSearchCodeTitle_n81i")
|
||||
)){
|
||||
alert("i18n_pidFile.keyword.allblank_n81i");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(Number(type) > 7 && startType == 1){ // 单次启动
|
||||
if(false ==(
|
||||
$id("processFile","","i18n_udsi.message.processFile_n81i")
|
||||
&& $id("processSearchCode","","i18n_udsi.text.processSearchCode_n81i")
|
||||
&& $id("processPath","","i18n_udsi.message.processPath_n81i")
|
||||
$id("processFile","","i18n_adsi.message.processFile_n81i")
|
||||
|| $id("processSearchCode","","i18n_adsi.message.processSearchCodeTitle_n81i")
|
||||
)){
|
||||
alert("i18n_pidFile.keyword.allblank_n81i");
|
||||
return;
|
||||
}else{
|
||||
if(! $id("processPath","","i18n_adsi.message.processPathTitle_n81i")){
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(Number(type) > 7 && startType == 2){ // 周期启动
|
||||
if(!$("#scriptFile").html()) { // 未上传脚本
|
||||
if(false ==(
|
||||
$id("myFile","","i18n_udsi.message.myFile_n81i")
|
||||
)){
|
||||
return;
|
||||
}
|
||||
if($("#myFile").val()==''){
|
||||
$("#myFile").next().html("i18n_adsi.message.myFile_n81i");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -602,7 +604,7 @@
|
||||
</td>
|
||||
<td class="color_3" colspan="3" align="left">
|
||||
<input type="text" name="detectionSetInfo.processFile" id="processFile" value="${detectionSetInfo.processFile}"/>
|
||||
<font color="red">*</font>
|
||||
<font color="red">* i18n_pidFile.keyword.allblank_n81i</font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="csd">
|
||||
@@ -611,7 +613,7 @@
|
||||
</td>
|
||||
<td class="color_3" colspan="3" align="left">
|
||||
<input type="text" name="detectionSetInfo.processSearchCode" id="processSearchCode" value="${detectionSetInfo.processSearchCode}"/>
|
||||
<font color="red">*i18n_udsi.message.processSearchCode_n81i</font>
|
||||
<font color="red">* i18n_udsi.message.processSearchCode_n81i</font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="dsd">
|
||||
|
||||
Reference in New Issue
Block a user