Merge branch 'Release-1.2' into feature-180908

# Conflicts:
#	src/main/resources/jdbc.properties
This commit is contained in:
doufenghu
2018-09-26 19:17:08 +08:00
31 changed files with 851 additions and 238 deletions

View File

@@ -0,0 +1,31 @@
package com.nis.domain.restful;
import java.io.Serializable;
import java.util.List;
import com.wordnik.swagger.annotations.ApiModel;
/**
*
* <p>Title: TrafficNmsServerStatistic</p>
* <p>Description: 记录nms服务器信息,全网机器总量,正常在线机器总数,异常机器列表</p>
* <p>Company: IIE</p>
* @author rkg
* @date 2018年8月17日
*
*/
@ApiModel(value = "TrafficNmsServerStatistic对象", description = "nms上报的服务器相关信息对象类")
public class TrafficNmsServerStatisticList implements Serializable {
private static final long serialVersionUID = 1L;
private List<TrafficNmsServerStatistic> trafficNmsServerList;
public List<TrafficNmsServerStatistic> getTrafficNmsServerList() {
return trafficNmsServerList;
}
public void setTrafficNmsServerList(List<TrafficNmsServerStatistic> trafficNmsServerList) {
this.trafficNmsServerList = trafficNmsServerList;
}
}

View File

@@ -0,0 +1,93 @@
package com.nis.domain.restful.dashboard;
import java.util.Date;
public class NtcTotalReport {
private Integer statId ;//int(11) NOT NULL AUTO_INCREMENT COMMENT id自增,
private Integer rejectNum ;//int(11) NOT NULL COMMENT 封堵数量,
private Integer monitorNum ;//int(11) NOT NULL COMMENT 监测数量,
private Integer c2sPktNum ;//int(11) DEFAULT NULL COMMENT c2s包数,
private Integer s2cPktNum ;//int(11) DEFAULT NULL COMMENT s2c包数,
private Integer c2sByteLen ;//int(11) NOT NULL COMMENT c2s字节数,
private Integer s2cByteLen ;//int(11) NOT NULL COMMENT s2c字节数,
private Integer newUniConnNum ;//int(11) DEFAULT NULL COMMENT 新建链接数,
private Integer liveConnNum ;//int(11) DEFAULT NULL COMMENT 活跃链接数,
private Integer dropConnNum ;//int(11) DEFAULT NULL COMMENT 丢弃链接数,
private Integer loopConnNum ;//int(11) DEFAULT NULL COMMENT 回流链接数,
private Date reportTime ;//datetime NOT NULL COMMENT 统计时间,
public Integer getStatId() {
return statId;
}
public void setStatId(Integer statId) {
this.statId = statId;
}
public Integer getRejectNum() {
return rejectNum;
}
public void setRejectNum(Integer rejectNum) {
this.rejectNum = rejectNum;
}
public Integer getMonitorNum() {
return monitorNum;
}
public void setMonitorNum(Integer monitorNum) {
this.monitorNum = monitorNum;
}
public Integer getC2sPktNum() {
return c2sPktNum;
}
public void setC2sPktNum(Integer c2sPktNum) {
this.c2sPktNum = c2sPktNum;
}
public Integer getS2cPktNum() {
return s2cPktNum;
}
public void setS2cPktNum(Integer s2cPktNum) {
this.s2cPktNum = s2cPktNum;
}
public Integer getC2sByteLen() {
return c2sByteLen;
}
public void setC2sByteLen(Integer c2sByteLen) {
this.c2sByteLen = c2sByteLen;
}
public Integer getS2cByteNen() {
return s2cByteLen;
}
public void setS2cByteNen(Integer s2cByteLen) {
this.s2cByteLen = s2cByteLen;
}
public Integer getNewUniConnNum() {
return newUniConnNum;
}
public void setNewUniConnNum(Integer newUniConnNum) {
this.newUniConnNum = newUniConnNum;
}
public Integer getLiveConnNum() {
return liveConnNum;
}
public void setLiveConnNum(Integer liveConnNum) {
this.liveConnNum = liveConnNum;
}
public Integer getDropConnNum() {
return dropConnNum;
}
public void setDropConnNum(Integer dropConnNum) {
this.dropConnNum = dropConnNum;
}
public Integer getLoopConnNum() {
return loopConnNum;
}
public void setLoopConnNum(Integer loopConnNum) {
this.loopConnNum = loopConnNum;
}
public Date getReportTime() {
return reportTime;
}
public void setReportTime(Date reportTime) {
this.reportTime = reportTime;
}
}

View File

@@ -23,8 +23,18 @@ public class TrafficHttpStatistic {
private Integer count;
private Integer pktNum;
private Integer byteLen;
private Integer websiteServiceId;//网站id
public Integer getCount() {
public Integer getWesiteServiceId() {
return websiteServiceId;
}
public void setWebsiteServiceId(Integer websiteServiceId) {
this.websiteServiceId = websiteServiceId;
}
public Integer getCount() {
return count;
}

View File

@@ -0,0 +1,38 @@
package com.nis.domain.restful.dashboard;
import java.util.Date;
public class TrafficPortActiveStatistic {
//流量统计之活跃端口统计
private Integer statId;
private Integer port;
private Integer sum;
private Date statTime;
public Integer getStatId() {
return statId;
}
public void setStatId(Integer statId) {
this.statId = statId;
}
public Integer getPort() {
return port;
}
public void setPort(Integer port) {
this.port = port;
}
public Integer getSum() {
return sum;
}
public void setSum(Integer sum) {
this.sum = sum;
}
public Date getStatTime() {
return statTime;
}
public void setStatTime(Date statTime) {
this.statTime = statTime;
}
}

View File

@@ -0,0 +1,59 @@
package com.nis.domain.restful.dashboard;
import java.util.Date;
public class WebsiteDomainTopic {
private Long id; // `id` bigint(20) NOT NULL AUTO_INCREMENT,
private Long websiteServiceId; // `website_service_id` bigint(20) DEFAULT NULL COMMENT '网站服务Id',
private String domain; // `domain` varchar(200) DEFAULT NULL COMMENT '域名',
private Long topicId; // `topic_id` bigint(20) DEFAULT NULL COMMENT '主题Id',
private Date createTime; // `create_time` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp(),
private Integer creatorId; // `creator_id` int(11) DEFAULT NULL,
private Integer isValid; // `is_valid` int(1) DEFAULT NULL,
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getWebsiteServiceId() {
return websiteServiceId;
}
public void setWebsiteServiceId(Long websiteServiceId) {
this.websiteServiceId = websiteServiceId;
}
public String getDomain() {
return domain;
}
public void setDomain(String domain) {
this.domain = domain;
}
public Long getTopicId() {
return topicId;
}
public void setTopicId(Long topicId) {
this.topicId = topicId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getCreatorId() {
return creatorId;
}
public void setCreatorId(Integer creatorId) {
this.creatorId = creatorId;
}
public Integer getIsValid() {
return isValid;
}
public void setIsValid(Integer isValid) {
this.isValid = isValid;
}
}

View File

@@ -592,6 +592,12 @@ public enum RestBusinessCode {
*/
RegionIsNotExist(5002010,"删除分组复用域配置时,无法在关联关系中找到对应的域配置信息,之前该域没有添加过,或者关联关系被损坏请检查"),
/**
*配置文件内容有误
*/
PropertiesIsError(5002011,"配置文件内容有误"),
/**
* 无法从Map中获取配置的属性值
*/

View File

@@ -29,7 +29,7 @@ public class ServiceAndRDBIndexReal {
* 记录哪些service可以被分组复用(只有maat类配置可以被分组复用)
* Map<Service,Map<regionName,List<tableName>>
*/
private static Map<Integer,Map<String, List<String>>> serviceGroupReuseMap = new HashMap<Integer, Map<String,List<String>>>();
private static Map<Integer, Map<String, List<String>>> serviceGroupReuseMap = new HashMap<Integer, Map<String, List<String>>>();
/**
* 第一个key是业务类型,第二个key是type(编译配置,分组配置,域配置)value是表名
@@ -57,35 +57,32 @@ public class ServiceAndRDBIndexReal {
private static Map<Integer, Map<String, String[]>> maatToValveMap = new HashMap<Integer, Map<String, String[]>>();
/**
* 阀门保存的redis数据库IndexseriveTable.properties中定义
* 阀门保存的redis数据库Indexnis.properties中定义
*/
private static Integer valveDBIndex = 7;
private static Integer valveDBIndex = Configurations.getIntProperty("tapRedisDb", 5);
static {
String unMaatService = Configurations.getStringProperty("unMaatService", "");
if (unMaatService != null && !unMaatService.trim().equals("")) {
String[] split = unMaatService.split(";");
for (String str : split) {
String[] serviceAction = str.split(":");
if (serviceAction.length==2) {
serviceActionMap.put(Integer.valueOf(serviceAction[0]),
Integer.valueOf(serviceAction[1]));
}else{
serviceActionMap.put(Integer.valueOf(serviceAction[0]),
null);
}
String serviceType = Configurations.getStringProperty(serviceAction[0], "");
if (serviceType != null && !serviceType.trim().equals("")) {
String[] typeArrs = serviceType.split(";");
for (String typeStr : typeArrs) {
String[] typeArr = typeStr.split(":");
String tableNameArr[] = typeArr[1].split(",");
for (String tableName : tableNameArr) {
unMaatSercieNameMap.put(Integer.parseInt(serviceAction[0]),
tableName.toUpperCase());
}
}
}
String[] serviceAction = str.split(":");
if (serviceAction.length == 2) {
serviceActionMap.put(Integer.valueOf(serviceAction[0]), Integer.valueOf(serviceAction[1]));
} else {
serviceActionMap.put(Integer.valueOf(serviceAction[0]), null);
}
String serviceType = Configurations.getStringProperty(serviceAction[0], "");
if (serviceType != null && !serviceType.trim().equals("")) {
String[] typeArrs = serviceType.split(";");
for (String typeStr : typeArrs) {
String[] typeArr = typeStr.split(":");
String tableNameArr[] = typeArr[1].split(",");
for (String tableName : tableNameArr) {
unMaatSercieNameMap.put(Integer.parseInt(serviceAction[0]), tableName.toUpperCase());
}
}
}
}
}
@@ -161,17 +158,17 @@ public class ServiceAndRDBIndexReal {
if (!StringUtil.isEmpty(serviceRepeatedReal)) {
String[] serviceRepeatedRealArr = serviceRepeatedReal.split(";");
for (String serviceRepeated : serviceRepeatedRealArr) {
String [] serInfos = serviceRepeated.split(":");
String [] regionInfos = serInfos[1].split("[|]");
String[] serInfos = serviceRepeated.split(":");
String[] regionInfos = serInfos[1].split("[|]");
for (String regionInfo : regionInfos) {
String [] regionTabName = regionInfo.split("@");
String [] tableNames = regionTabName[1].split(",");
String[] regionTabName = regionInfo.split("@");
String[] tableNames = regionTabName[1].split(",");
for (String tableName : tableNames) {
Integer ser = Integer.valueOf(serInfos[0]);
if(serviceGroupReuseMap.containsKey(ser)){
if (serviceGroupReuseMap.containsKey(ser)) {
serviceGroupReuseMap.get(ser).get(regionTabName[0]).add(tableName);
}else{
Map<String,List<String>> regTabMap = new HashMap<String, List<String>>();
} else {
Map<String, List<String>> regTabMap = new HashMap<String, List<String>>();
List<String> tabList = new ArrayList<String>();
tabList.add(tableName);
regTabMap.put(regionTabName[0], tabList);
@@ -183,8 +180,6 @@ public class ServiceAndRDBIndexReal {
}
}
public static void main(String[] args) {
// getUnMaatTable();
getMaatTable();
@@ -326,7 +321,7 @@ public class ServiceAndRDBIndexReal {
return null;
}
/**
* 判断service是否被分组复用
* @param service
@@ -336,10 +331,25 @@ public class ServiceAndRDBIndexReal {
if (service != null) {
return serviceGroupReuseMap.containsKey(service);
} else {
throw new ServiceRuntimeException("判断service是否是分组复用时发生了异常,异常原因:service=null", RestBusinessCode.ServiceIsNull.getValue());
throw new ServiceRuntimeException("判断service是否是分组复用时发生了异常,异常原因:service=null",
RestBusinessCode.ServiceIsNull.getValue());
}
}
/**
* 验证当前service是否是向阀门添加action,service或者userregion等属性
* @param service
* @return
*/
public static boolean isAddASU(int service) {
boolean isValve = false;
Map<String, String[]> map2 = maatToValveMap.get(service);
if (map2 != null && map2.size() > 0) {
isValve = true;
}
return isValve;
}
/**
* 根据业务类型获取unmaat配置表名
* @param service
@@ -401,6 +411,7 @@ public class ServiceAndRDBIndexReal {
public static void setUnMaatSercieNameMap(Map<Integer, String> unMaatSercieNameMap) {
ServiceAndRDBIndexReal.unMaatSercieNameMap = unMaatSercieNameMap;
}
/**
* @return the serviceGroupReuseMap
*/
@@ -416,7 +427,7 @@ public class ServiceAndRDBIndexReal {
List<String> list = new ArrayList<String>();
list.addAll(map.get(regionName));
groupReuseRegionMap.put(regionName, list);
}else{
} else {
groupReuseRegionMap.get(regionName).addAll(map.get(regionName));
}
}

View File

@@ -6,6 +6,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import com.nis.domain.restful.dashboard.TrafficPortActiveStatistic;
import com.nis.restful.RestServiceException;
import com.nis.util.Constants;
import javax.servlet.http.HttpServletRequest;
@@ -34,6 +35,67 @@ public class DashboardServiceController extends BaseRestController {
protected ServicesRequestLogService servicesRequestLogService;
@Autowired
public DashboardService dashboardService;
/**
* 流量统计info滚动条数据显示 封堵监测回流丢弃
*/
@RequestMapping(value = "ntcTotalReport", method = RequestMethod.GET)
@ApiOperation(value = "业务总量汇聚", httpMethod = "GET", notes = "对应流量统计info滚动条数据显示")
public Map<String,?> ntcTotalReport(Model model, HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null);
List<Map> list = new ArrayList<Map>();
try {
List<Map> resultList = dashboardService.getTotalReportList();
if (resultList!=null&&resultList.size() > 0) {
list = resultList;
}
} catch (Exception e) {
e.printStackTrace();
auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "业务总量汇聚实时统计数据检索失败");
}
throw ((RestServiceException) e);
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "业务总量汇聚实时统计数据检索成功",list, 0);
}
/**
* 流量统计活跃端口统计
*/
@RequestMapping(value = "trafficPortActive", method = RequestMethod.GET)
@ApiOperation(value = "活跃端口统计", httpMethod = "GET", notes = "对应流量统计活跃端口统计")
public Map<String,?> trafficPortActive(Model model, HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null);
List<Map> list = new ArrayList<Map>();
try {
List<TrafficPortActiveStatistic> resultList = dashboardService.getPortActiveList();
if (resultList!=null&&resultList.size() > 0) {
for (TrafficPortActiveStatistic port : resultList) {
Map map = new HashMap();
map.put("port", port.getPort());
map.put("sum", port.getSum());
list.add(map);
}
}
} catch (Exception e) {
e.printStackTrace();
auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "活跃端口实时统计数据检索失败");
}
throw ((RestServiceException) e);
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "活跃端口实时统计数据检索成功",list, 0);
}
/**
* 协议统计
@@ -92,7 +154,7 @@ public class DashboardServiceController extends BaseRestController {
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "活跃IP实时统计数据检索成功",list, 0);
}
/**
* app流量分析 TOP10
* app应用流量分析 TOP10
*/
@RequestMapping(value = "trafficApp", method = RequestMethod.GET)
@ApiOperation(value = "app流量分析统计", httpMethod = "GET", notes = "对应app流量分析实时统计查询服务。")
@@ -215,7 +277,8 @@ public class DashboardServiceController extends BaseRestController {
AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null);
List<Map> list = new ArrayList<Map>();
try {
List<Map> websiteChart = dashboardService.websiteList();
// List<Map> websiteChart = dashboardService.websiteList();
List<Map> websiteChart = dashboardService.getDomainByWebsiteList();
if (websiteChart.size() > 0) {
list = websiteChart;
}
@@ -232,13 +295,13 @@ public class DashboardServiceController extends BaseRestController {
}
@RequestMapping(value = "trafficWebTypeChart", method = RequestMethod.GET)
@ApiOperation(value = "http网站分类分析统计", httpMethod = "GET", notes = "对应某个网站类型分类统计图")
public Map<String, ?> trafficWebTypeChart(Integer webId,Model model, HttpServletRequest request, HttpServletResponse response) {
public Map<String, ?> trafficWebTypeChart(Integer websiteServiceId,Model model, HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null);
List<Map> list = new ArrayList<Map>();
try {
List<Map> websiteChart = dashboardService.getTypeBywebsite(webId);
List<Map> websiteChart = dashboardService.getDomainByWebsiteServiceId(websiteServiceId);
if (websiteChart.size() > 0) {
list = websiteChart;
}
@@ -253,4 +316,27 @@ public class DashboardServiceController extends BaseRestController {
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "http网站分类分析数据检索成功",list, 0);
}
@RequestMapping(value = "trafficTopicAndDomainChart", method = RequestMethod.GET)
@ApiOperation(value = "http网站主题分类分析统计", httpMethod = "GET", notes = "对应某个网站主题类型分类统计图")
public Map<String, ?> trafficTopicAndDomainChart(Integer websiteServiceId,Model model, HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null);
List<Map> list = new ArrayList<Map>();
try {
List<Map> websiteChart = dashboardService.getTopicAndDomainList();
if (websiteChart.size() > 0) {
list = websiteChart;
}
} catch (Exception e) {
e.printStackTrace();
auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "http网站主题分类分析数据检索失败");
}
throw ((RestServiceException) e);
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "http网站主题分类分析数据检索成功",list, 0);
}
}

View File

@@ -1,21 +1,19 @@
package com.nis.web.controller.restful;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.nis.domain.restful.TrafficNmsServerStatistic;
import com.nis.domain.restful.TrafficNmsServerStatisticList;
import com.nis.restful.RestBusinessCode;
import com.nis.restful.RestConstants;
import com.nis.restful.RestServiceException;
import com.nis.util.Constants;
import com.nis.web.controller.BaseRestController;
@@ -38,30 +36,28 @@ public class NmsInfoController extends BaseRestController {
@RequestMapping(value = "/nms/v1/saveServerStatus", method = RequestMethod.POST)
@ApiOperation(value = "存储NMS系统上报的服务器状态接口", httpMethod = "POST", response = Map.class, notes = "接收NMS系统上报的服务器状态信息")
@ApiParam(value = "存储NMS系统上报的服务器状态接口", name = "saveServerStatus", required = true)
public Map<String, Object> saveServerStatus(@RequestBody TrafficNmsServerStatistic trafficNmsServerStatistic,
HttpServletRequest request, HttpServletResponse response) {
public Map<String, Object> saveServerStatus(
@RequestBody TrafficNmsServerStatisticList trafficNmsServerStatisticList, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request,
trafficNmsServerStatistic);
Map<String, Object> map = new HashMap<String, Object>();
map.put(RestConstants.REST_SERVICE_HTTP_STATUS, HttpStatus.OK);
trafficNmsServerStatisticList);
try {
TrafficNmsServerStatistic saveNmsServer = trafficNmsServerStatisticService
.saveNmsServer(trafficNmsServerStatistic);
try {
trafficNmsServerStatisticService.saveAbnormalMachine(saveNmsServer.getId(),
saveNmsServer.getAbnormalMachineList());
} catch (Exception e) {
trafficNmsServerStatisticService.delNmsServer(saveNmsServer);
throw e;
if (trafficNmsServerStatisticList != null && trafficNmsServerStatisticList.getTrafficNmsServerList() != null
&& trafficNmsServerStatisticList.getTrafficNmsServerList().size() > 0) {
trafficNmsServerStatisticService.saveNmsInfo(trafficNmsServerStatisticList.getTrafficNmsServerList());
} else {
throw new RestServiceException(thread, System.currentTimeMillis() - start, "参数trafficNmsServerList不能为空",
RestBusinessCode.missing_args.getValue());
}
} catch (Exception e) {
throw new RestServiceException(thread, System.currentTimeMillis() - start, "上报服务器状态信息异常:" + e.getMessage(),
RestBusinessCode.unknow_error.getValue());
}
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "上报服务器状态信息成功",
Constants.IS_DEBUG ? trafficNmsServerStatistic : null);
Constants.IS_DEBUG ? trafficNmsServerStatisticList : null);
}
}

View File

@@ -364,7 +364,7 @@ public class SingleDimensionReport extends BaseRestController {
*/
public void resetReportTime(NtcReportEntity<?> entity,Boolean isTotal) throws Exception {
//日志总量统计查询全部
if ("1".equals(entity.getSearchBusinessType())) {
if ("1".equals(entity.getSearchBusinessType())&&isTotal) {
return ;
}
if (StringUtil.isEmpty(entity.getSearchReportStartTime())&&StringUtil.isEmpty(entity.getSearchReportEndTime())) {

View File

@@ -0,0 +1,13 @@
package com.nis.web.dao.dashboard;
import java.util.List;
import java.util.Map;
import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface NtcTotalReportDao {
List<Map> getTotalReportList();
List<Map> getNetFlowPortInfoNew();
List<Map> getNetFlowPortInfoOld();
}

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.dashboard.NtcTotalReportDao">
<!-- <resultMap id="BaseResultMap" type="com.nis.domain.restful.dashboard.NtcTotalReport">
<id column="stat_id" jdbcType="INTEGER" property="statId" />
<result column="app_type" jdbcType="INTEGER" property="appType" />
<result column="entrance_id" jdbcType="INTEGER" property="entranceId" />
<result column="c2s_pkt_num" jdbcType="INTEGER" property="c2sPktNum" />
<result column="s2c_pkt_num" jdbcType="INTEGER" property="s2cPktNum" />
<result column="c2s_byte_len" jdbcType="INTEGER" property="c2sByteLen" />
<result column="s2c_byte_len" jdbcType="INTEGER" property="s2cByteLen" />
<result column="stat_time" jdbcType="TIMESTAMP" property="statTime" />
</resultMap> -->
<!-- <select id="appChart" resultType="java.util.HashMap">
SELECT app_type appType, (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)+SUM(c2s_byte_len)+SUM(s2c_byte_len)) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_app_statistic
WHERE app_type !=0 and stat_time >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
GROUP BY app_type order by count desc limit 0,10
</select> -->
<select id="getTotalReportList" resultType="java.util.HashMap">
SELECT SUM(reject_num) rejectNum,SUM(monitor_num) monitorNum,SUM(c2s_pkt_num) c2sPktNum,SUM(s2c_pkt_num) s2cPktNum,SUM(c2s_byte_len) c2sByteLen,SUM(s2c_byte_len) s2cByteLen,SUM(new_uni_conn_num) newUniConnNum,SUM(live_conn_num) liveConnNum,
SUM(drop_conn_num) dropConnNum,SUM(loop_conn_num) loopConnNum FROM galaxy.ntc_total_report
where report_time >= DATE_SUB((SELECT MAX(report_time) FROM galaxy.ntc_total_report),INTERVAL 5 MINUTE)
</select>
<select id="getNetFlowPortInfoNew" resultType="java.util.HashMap">
SELECT SUM(INOCTETS) inoctets ,SUM(OUTOCTETS) outoctets FROM galaxy.TRAFFIC_NETFLOW_PORT_INFO
where RECV_TIME >= DATE_SUB((SELECT MAX(RECV_TIME) FROM galaxy.TRAFFIC_NETFLOW_PORT_INFO),INTERVAL 4 MINUTE)
</select>
<select id="getNetFlowPortInfoOld" resultType="java.util.HashMap">
SELECT SUM(INOCTETS) inoctets ,SUM(OUTOCTETS) outoctets FROM galaxy.TRAFFIC_NETFLOW_PORT_INFO
where RECV_TIME between DATE_SUB((SELECT MAX(RECV_TIME) FROM galaxy.TRAFFIC_NETFLOW_PORT_INFO),INTERVAL 9 MINUTE)
and DATE_SUB((SELECT MAX(RECV_TIME) FROM galaxy.TRAFFIC_NETFLOW_PORT_INFO),INTERVAL 4 MINUTE)
</select>
</mapper>

View File

@@ -16,8 +16,9 @@
stat_time
</sql>
<select id="appChart" resultType="java.util.HashMap">
SELECT app_type appType, (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)+SUM(c2s_byte_len)+SUM(s2c_byte_len)) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_app_statistic
WHERE app_type !=0 and stat_time >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
SELECT app_type appType, (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)+SUM(c2s_byte_len)+SUM(s2c_byte_len)) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen
FROM galaxy.traffic_app_statistic
WHERE app_type !=0 and stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_app_statistic),INTERVAL 5 MINUTE)
GROUP BY app_type order by count desc limit 0,10
</select>
</mapper>

View File

@@ -10,10 +10,14 @@ import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface TrafficHttpStatisticDao {
List<TrafficHttpStatistic> websiteList();
List<Map> getTypeBywebsite(@Param("webId") Integer webId);
Map websiteTypeOthers(@Param("webType") List webType,@Param("webId") Integer webId);
//获取域名分类之后属于的网站
List<TrafficHttpStatistic> getDomainByWebsiteList();
Integer preWebsiteListCount(@Param("websiteServiceId") Integer websiteServiceId);
List<Map> getDomainByWebsiteServiceId(@Param("websiteServiceId") Integer websiteServiceId);
Map websiteDomainOthers(@Param("webIdList") List webIdList,@Param("websiteServiceId") Integer websiteServiceId);
Integer preWebsiteListCount(@Param("webId") Integer webId);
List<Map> getDomainByTopicList();
List<Map> getDomainByTopicId(@Param("topicId")Object TopicId);
}

View File

@@ -3,7 +3,7 @@
<mapper namespace="com.nis.web.dao.dashboard.TrafficHttpStatisticDao">
<resultMap id="BaseResultMap" type="com.nis.domain.restful.dashboard.TrafficHttpStatistic">
<id column="stat_id" jdbcType="INTEGER" property="statId" />
<result column="web_type" jdbcType="INTEGER" property="webType" />
<result column="link_num" jdbcType="INTEGER" property="linkNum" />
<result column="web_id" jdbcType="INTEGER" property="webId" />
<result column="c2s_pkt_num" jdbcType="INTEGER" property="c2sPktNum" />
<result column="s2c_pkt_num" jdbcType="INTEGER" property="s2cPktNum" />
@@ -15,34 +15,65 @@
stat_id, web_type, web_id, c2s_pkt_num, s2c_pkt_num, c2s_byte_len, s2c_byte_len,
stat_time
</sql>
<!--获取网站列表列表 -->
<select id="websiteList" resultMap="BaseResultMap">
SELECT web_id webId, (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)+SUM(c2s_byte_len)+SUM(s2c_byte_len)) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_http_statistic
WHERE web_id !=0 and stat_time >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
GROUP BY web_id ORDER BY count DESC limit 0,10
</select>
<!-- 根据网站分类 -->
<select id="getTypeBywebsite" parameterType="java.lang.Integer" resultType="java.util.HashMap">
SELECT web_type webType, (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)+SUM(c2s_byte_len)+SUM(s2c_byte_len)) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_http_statistic
WHERE web_type !=0 and web_id=#{webId} and stat_time >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
GROUP BY web_type ORDER BY count limit 0,10
</select>
<!--获取上个时间段网站流量的数据量 -->
<!-- 根据服务网站将域名分类 网站列表-->
<select id="getDomainByWebsiteList" resultType="com.nis.domain.restful.dashboard.TrafficHttpStatistic">
SELECT SUM(link_num) count, IFNULL( website_service_id, 268435455 ) websiteServiceId ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen
FROM galaxy.TRAFFIC_HTTP_STATISTIC t
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id = u.id
and t.stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 5 MINUTE)
GROUP BY u.website_service_id ORDER BY count limit 0,10
</select>
<!-- 根据主题将域名分类 主题列表 最近五分钟top10-->
<select id="getDomainByTopicList" resultType="java.util.HashMap">
SELECT SUM(link_num) count, IFNULL( topic_id, 268435455 ) topicId ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen
FROM galaxy.TRAFFIC_HTTP_STATISTIC t
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id = u.id
and t.stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 5 MINUTE)
GROUP BY u.topic_id ORDER BY count limit 0,10
</select>
SELECT (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)+SUM(c2s_byte_len)+SUM(s2c_byte_len)) count FROM galaxy.traffic_http_statistic
WHERE web_type !=0 and web_id=#{webId}
and stat_time between DATE_SUB(NOW(),INTERVAL 10 MINUTE) and DATE_SUB(NOW(),INTERVAL 5 MINUTE)
<!--获取上个时间段该网站站域名流量的数据量 -->
<select id="preWebsiteListCount" resultType="java.lang.Integer">
SELECT SUM(link_num) count FROM galaxy.traffic_http_statistic t
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id = u.id
WHERE u.website_service_id=#{websiteServiceId}
and stat_time between DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 10 MINUTE) and DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 5 MINUTE)
</select>
<!--获取网站列表列表 -->
<!-- <select id="websiteList" resultMap="BaseResultMap">
SELECT web_id webId, (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)+SUM(c2s_byte_len)+SUM(s2c_byte_len)) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_http_statistic
WHERE web_id !=0 and stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 5 MINUTE)
GROUP BY web_id ORDER BY count DESC limit 0,10
</select> -->
<!-- 根据网站分组获取子域名 -->
<select id="getDomainByWebsiteServiceId" parameterType="java.lang.Integer" resultType="java.util.HashMap">
SELECT web_id webId,SUM(link_num) count,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen
FROM galaxy.traffic_http_statistic t
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id=u.id
where u.website_service_id=#{websiteServiceId}
and t.stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 5 MINUTE)
GROUP BY t.web_id ORDER BY count limit 0,10
</select>
<!-- 根据主题分组获取子域名 -->
<select id="getDomainByTopicId" resultType="java.util.HashMap">
SELECT web_id webId,SUM(link_num) count,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen
FROM galaxy.traffic_http_statistic t
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id=u.id
where u.topic_id=#{topicId}
and t.stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 5 MINUTE)
GROUP BY t.web_id ORDER BY count limit 0,10
</select>
<select id="websiteTypeOthers" resultType="java.util.HashMap">
SELECT (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)+SUM(c2s_byte_len)+SUM(s2c_byte_len)) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_http_statistic
WHERE web_type !=0 and web_id=#{webId}
<if test="webType!=null and webType.size()>0">
and bs_type not in
<foreach collection="webType" item="singleType" index="index" open="(" close=")" separator=",">
<!-- 指定网站下的TOP10之外为others -->
<select id="websiteDomainOthers" resultType="java.util.HashMap">
SELECT SUM(link_num) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_http_statistic t
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id=u.id
where u.website_service_id=#{websiteServiceId}
<if test="webIdList!=null and webIdList.size()>0">
and t.web_id not in
<foreach collection="webIdList" item="singleType" index="index" open="(" close=")" separator=",">
#{singleType}
and stat_time >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
</foreach>
</if>
and stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 5 MINUTE)

View File

@@ -26,8 +26,8 @@
<!-- IP流量统计-->
<select id="ipActiveChart" resultType="java.util.LinkedHashMap">
SELECT ip_addr ipAddr, SUM(link_num) linkNum ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ip_active_statistic
WHERE stat_time >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
GROUP BY ip_addr ORDER BY link_num DESC limit 0,10
WHERE stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ip_active_statistic),INTERVAL 5 MINUTE)
GROUP BY ip_addr ORDER BY linkNum DESC limit 0,10
</select>
</mapper>

View File

@@ -0,0 +1,12 @@
package com.nis.web.dao.dashboard;
import java.util.List;
import java.util.Map;
import com.nis.domain.restful.dashboard.TrafficPortActiveStatistic;
import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface TrafficPortActiveStatisticDao {
List<TrafficPortActiveStatistic> getPortActiveList();
}

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.dashboard.TrafficPortActiveStatisticDao">
<resultMap id="BaseResultMap" type="com.nis.domain.restful.dashboard.TrafficPortActiveStatistic">
<id column="stat_id" jdbcType="INTEGER" property="statId" />
<result column="port" jdbcType="INTEGER" property="port" />
<result column="sum" jdbcType="INTEGER" property="sum" />
<result column="stat_time" jdbcType="TIMESTAMP" property="statTime" />
</resultMap>
<select id="getPortActiveList" resultMap="BaseResultMap">
SELECT port ,SUM(sum) sum from galaxy.traffic_port_active_statistic
WHERE stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_port_active_statistic),INTERVAL 5 MINUTE)
GROUP BY port order by sum limit 0,10
</select>
</mapper>

View File

@@ -16,6 +16,7 @@
stat_time
</sql>
<select id="protocolChart" resultType="java.util.HashMap">
SELECT proto_type protoType, ( SUM(c2s_pkt_num) + SUM(s2c_pkt_num) + SUM(c2s_byte_len) + SUM(s2c_byte_len)) count, ( SUM(c2s_pkt_num) + SUM(s2c_pkt_num)) pktNum, ( SUM(c2s_byte_len) + SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_protocol_statistic WHERE proto_type != 0 AND stat_time >= DATE_SUB(NOW(), INTERVAL 5 MINUTE) GROUP BY proto_type ORDER BY count DESC LIMIT 0, 10
SELECT proto_type protoType, SUM(link_num) count, ( SUM(c2s_pkt_num) + SUM(s2c_pkt_num)) pktNum, ( SUM(c2s_byte_len) + SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_protocol_statistic WHERE proto_type != 0
AND stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_protocol_statistic), INTERVAL 5 MINUTE) GROUP BY proto_type ORDER BY count DESC LIMIT 0, 10
</select>
</mapper>

View File

@@ -18,25 +18,25 @@
</sql>
<!--获取操作系统列表TOP10 -->
<select id="systemList" resultMap="BaseResultMap">
SELECT os_type osType, (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)+SUM(c2s_byte_len)+SUM(s2c_byte_len)) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
WHERE os_type !=0 and stat_time >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
SELECT os_type osType, SUM(link_num) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
WHERE os_type !=0 and stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic),INTERVAL 5 MINUTE)
GROUP BY os_type ORDER BY count DESC limit 0,10
</select>
<!--获取上个时间段操作系统的数据量 -->
<select id="preSystemListCount" resultType="java.lang.Integer">
SELECT (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)+SUM(c2s_byte_len)+SUM(s2c_byte_len)) count FROM galaxy.traffic_ua_statistic
SELECT SUM(link_num) count FROM galaxy.traffic_ua_statistic
WHERE os_type !=0 and os_type=#{osType}
and stat_time between DATE_SUB(NOW(),INTERVAL 10 MINUTE) and DATE_SUB(NOW(),INTERVAL 5 MINUTE)
and stat_time between DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic),INTERVAL 10 MINUTE) and DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic),INTERVAL 5 MINUTE)
</select>
<!-- 根据操作系统获取浏览器分类 -->
<select id="getBrowserBySystem" parameterType="java.lang.Integer" resultType="java.util.HashMap">
SELECT bs_type bsType, (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)+SUM(c2s_byte_len)+SUM(s2c_byte_len)) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
WHERE bs_type !=0 and os_type=#{osType} and stat_time >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
SELECT bs_type bsType, SUM(link_num) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
WHERE bs_type !=0 and os_type=#{osType} and stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic),INTERVAL 5 MINUTE)
GROUP BY bs_type ORDER BY count DESC limit 0,10
</select>
<!--浏览器TOP10后所有为others -->
<select id="systemOthers" resultType="java.util.HashMap">
SELECT (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)+SUM(c2s_byte_len)+SUM(s2c_byte_len)) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
SELECT SUM(link_num) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
WHERE bs_type !=0 and os_type=#{osType}
<if test="bsType!=null and bsType.size()>0">
and os_type not in
@@ -44,30 +44,30 @@
#{singleType}
</foreach>
</if>
and stat_time >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
and stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic),INTERVAL 5 MINUTE)
</select>
<!--获取浏览器列表TOP10 -->
<select id="browserList" resultMap="BaseResultMap">
SELECT bs_type bsType, (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)+SUM(c2s_byte_len)+SUM(s2c_byte_len)) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
WHERE bs_type !=0 and stat_time >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
SELECT bs_type bsType, SUM(link_num) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
WHERE bs_type !=0 and stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic),INTERVAL 5 MINUTE)
GROUP BY bs_type ORDER BY count DESC limit 0,10
</select>
<!--获取上个时间段浏览器的数据量 -->
<select id="preBrowserListCount" resultType="java.lang.Integer">
SELECT (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)+SUM(c2s_byte_len)+SUM(s2c_byte_len)) count FROM galaxy.traffic_ua_statistic
SELECT SUM(link_num) count FROM galaxy.traffic_ua_statistic
WHERE bs_type !=0 and bs_type=#{bsType}
and stat_time between DATE_SUB(NOW(),INTERVAL 10 MINUTE) and DATE_SUB(NOW(),INTERVAL 5 MINUTE)
and stat_time between DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic),INTERVAL 10 MINUTE) and DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic),INTERVAL 5 MINUTE)
</select>
<!-- 根据浏览器获取操作系统分类 -->
<select id="getSystemBybrowser" parameterType="java.lang.Integer" resultType="java.util.HashMap">
SELECT os_type osType, (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)+SUM(c2s_byte_len)+SUM(s2c_byte_len)) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
WHERE os_type !=0 and bs_type=#{bsType} and stat_time >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
SELECT os_type osType, SUM(link_num) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
WHERE os_type !=0 and bs_type=#{bsType} and stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic),INTERVAL 5 MINUTE)
GROUP BY os_type ORDER BY count DESC limit 0,10
</select>
<!--操作系统TOP10后所有为others -->
<select id="browserOthers" parameterType="java.util.List" resultType="java.util.HashMap">
SELECT (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)+SUM(c2s_byte_len)+SUM(s2c_byte_len)) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
SELECT SUM(link_num) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
WHERE os_type !=0 and bs_type=#{bsType}
<if test="osType!=null and osType.size()>0">
and bs_type not in
@@ -75,6 +75,6 @@
#{singleType}
</foreach>
</if>
and stat_time >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
and stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic),INTERVAL 5 MINUTE)
</select>
</mapper>

View File

@@ -32,7 +32,7 @@ import redis.clients.jedis.exceptions.JedisConnectionException;
@Service()
public class ConfigJedisServiceimpl implements ConfigRedisService {
private static Logger logger = LoggerFactory.getLogger(ConfigJedisServiceimpl.class);
private static final int TAPREDISDB = Configurations.getIntProperty("tapRedisDb", 7);
private static final int TAPREDISDB = Configurations.getIntProperty("tapRedisDb", 5);
// 用于在实时统计配置后面添加时间,方便读取入库时间
private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
@@ -445,6 +445,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
Jedis resource = JedisUtils.getResource(0);
Transaction transaction = resource.multi();
try {
Set<Integer> keySet = configMap.keySet();
for (Integer redisDBIndex : configMap.keySet()) {
if (redisDBIndex >= 0 && redisDBIndex < Configurations.getIntProperty("maxRedisDBIndex", 6)) {
transaction.select(redisDBIndex);
@@ -458,6 +459,13 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
if (maatConfigList != null && maatConfigList.size() > 0) {
for (MaatConfig maatConfig : maatConfigList) {
int service = maatConfig.getService();
if (ServiceAndRDBIndexReal.isAddASU(service)) {
if (!keySet.contains(TAPREDISDB)) {
throw new ServiceRuntimeException("业务类型:" + service + ",需要向阀门" + TAPREDISDB + "号库分发,但是当前只往"
+ keySet + "库下发,请检查阀门编号或者当前业务对应的配置文件是否正确",RestBusinessCode.PropertiesIsError.getValue());
}
}
MaatXmlConfig maatXmlConfig = ReadMaatXmlUtil.getMaatConfigByService(service);
setConfig(maatConfig, maatXmlConfig, maatVersion, service, transaction,
redisDBIndex);

View File

@@ -12,10 +12,13 @@ import org.springframework.stereotype.Service;
import com.nis.domain.Page;
import com.nis.domain.restful.dashboard.TrafficHttpStatistic;
import com.nis.domain.restful.dashboard.TrafficIpActiveStatistic;
import com.nis.domain.restful.dashboard.TrafficPortActiveStatistic;
import com.nis.domain.restful.dashboard.TrafficUaStatistic;
import com.nis.web.dao.dashboard.NtcTotalReportDao;
import com.nis.web.dao.dashboard.TrafficAppStatisticDao;
import com.nis.web.dao.dashboard.TrafficHttpStatisticDao;
import com.nis.web.dao.dashboard.TrafficIpActiveStatisticDao;
import com.nis.web.dao.dashboard.TrafficPortActiveStatisticDao;
import com.nis.web.dao.dashboard.TrafficProtocolStatisticDao;
import com.nis.web.dao.dashboard.TrafficUaStatisticDao;
import com.nis.web.service.BaseService;
@@ -33,6 +36,49 @@ public class DashboardService extends BaseService{
public TrafficUaStatisticDao trafficUaStatisticDao;
@Autowired
public TrafficHttpStatisticDao trafficHttpStatisticDao;
@Autowired
public NtcTotalReportDao ntcTotalReportDao;
@Autowired
public TrafficPortActiveStatisticDao trafficPortActiveStatisticDao;
/**
* 流量统计 数据显示
* @return Map
*/
public List<Map> getTotalReportList(){
List<Map> totalReportList = ntcTotalReportDao.getTotalReportList();
//统计带宽的流入流出 单位 五分钟 的 byte
List<Map> newData = ntcTotalReportDao.getNetFlowPortInfoNew();
List<Map> oldData = ntcTotalReportDao.getNetFlowPortInfoOld();
Double inoctets=0d;
Double outoctets=0d;
if(newData!=null&&newData.size()>0&&oldData!=null&&oldData.size()>0&&newData.get(0)!=null&&oldData.get(0)!=null){
Double newInoctets=Double.parseDouble(newData.get(0).get("inoctets").toString()) ;
Double newOutoctets=Double.parseDouble(newData.get(0).get("outoctets").toString()) ;
Double oldInoctets=Double.parseDouble(oldData.get(0).get("inoctets").toString());
Double oldOutoctets=Double.parseDouble(oldData.get(0).get("outoctets").toString());
//结果为当前五分钟减去上个五分钟
inoctets=newInoctets-oldInoctets;
outoctets=newOutoctets-oldOutoctets;
if(inoctets<0||outoctets<0){
inoctets=0d;
outoctets=0d;
}
}
if(totalReportList!=null&&totalReportList.size()>0){
for (Map map : totalReportList) {
map.put("inoctets", inoctets);
map.put("outoctets", outoctets);
}
}
return totalReportList;
}
public List<TrafficPortActiveStatistic> getPortActiveList(){
List<TrafficPortActiveStatistic> portActiveList = trafficPortActiveStatisticDao.getPortActiveList();
return portActiveList;
}
/**
* 分页查询活跃IPtop100
@@ -108,19 +154,21 @@ public class DashboardService extends BaseService{
List<Map> result = new ArrayList<Map>();
List<TrafficUaStatistic> list = trafficUaStatisticDao.browserList();
Integer preCount=0;
for (TrafficUaStatistic ua : list) {
Map map = new HashMap();
map.put("bsType",ua.getBsType());
map.put("count",ua.getCount());
map.put("pktNum",ua.getPktNum());
map.put("byteLen",ua.getByteLen());
preCount = trafficUaStatisticDao.preBrowserListCount(ua.getBsType());//上个时段的量 用于与现在对比
if(preCount!=null){
map.put("preCount",preCount);
}else{
map.put("preCount",0);
if(list!=null&&list.size()>0){
for (TrafficUaStatistic ua : list) {
Map map = new HashMap();
map.put("bsType",ua.getBsType());
map.put("count",ua.getCount());
map.put("pktNum",ua.getPktNum());
map.put("byteLen",ua.getByteLen());
preCount = trafficUaStatisticDao.preBrowserListCount(ua.getBsType());//上个时段的量 用于与现在对比
if(preCount!=null){
map.put("preCount",preCount);
}else{
map.put("preCount",0);
}
result.add(map);
}
result.add(map);
}
return result;
}
@@ -145,37 +193,91 @@ public class DashboardService extends BaseService{
List<Map> result = new ArrayList<Map>();
List<TrafficHttpStatistic> list = trafficHttpStatisticDao.websiteList();
Integer preCount=0;
for (TrafficHttpStatistic website : list) {
Map map = new HashMap();
map.put("webId",website.getWebId());
map.put("count",website.getCount());
map.put("pktNum",website.getPktNum());
map.put("byteLen",website.getByteLen());
preCount = trafficHttpStatisticDao.preWebsiteListCount(website.getWebId());//上个时段的量 用于与现在对比
if(preCount!=null){
map.put("preCount",preCount);
}else{
map.put("preCount",0);
if(list!=null&&list.size()>0){
for (TrafficHttpStatistic website : list) {
Map map = new HashMap();
map.put("webId",website.getWebId());
map.put("count",website.getCount());
map.put("pktNum",website.getPktNum());
map.put("byteLen",website.getByteLen());
preCount = trafficHttpStatisticDao.preWebsiteListCount(website.getWebId());//上个时段的量 用于与现在对比
if(preCount!=null){
map.put("preCount",preCount);
}else{
map.put("preCount",0);
}
result.add(map);
}
result.add(map);
}
return result;
}
public List<Map> getTypeBywebsite(Integer webId ){
List<Map> list = trafficHttpStatisticDao.getTypeBywebsite(webId);
List webType = new ArrayList();
//查询固定网站下的除了TOP10以外的others分类
/**
* 根据网站服务查询子域名
* @param websiteServiceId
* @return list
*/
public List<Map> getDomainByWebsiteServiceId(Integer websiteServiceId ){
List<Map> list = trafficHttpStatisticDao.getDomainByWebsiteServiceId(websiteServiceId);
List webIdList = new ArrayList();
//查询固定网站下的域名除了TOP10以外的others域名
if(list!=null&& list.size()>0){
for (Map map : list) {
webType.add(map.get("webType"));
webIdList.add(map.get("webId"));
}
Map others = new HashMap();
others = trafficHttpStatisticDao.websiteTypeOthers(webType,webId);
others = trafficHttpStatisticDao.websiteDomainOthers(webIdList,websiteServiceId);
if(others!=null&&others.size()>0){
others.put("webType", "-1");
others.put("webId", "-1");
list.add(others);
}
}
return list;
}
/**
获取网站列表
* @return
*/
@SuppressWarnings("unchecked")
public List<Map> getDomainByWebsiteList(){
List<TrafficHttpStatistic> websiteList = trafficHttpStatisticDao.getDomainByWebsiteList();
List<Map> result = new ArrayList<Map>();
if(websiteList!=null&&websiteList.size()>0){
Integer preCount=0;
for (TrafficHttpStatistic website : websiteList) {
Map map = new HashMap();
map.put("websiteServiceId",website.getWesiteServiceId());
map.put("count",website.getCount());
map.put("pktNum",website.getPktNum());
map.put("byteLen",website.getByteLen());
preCount = trafficHttpStatisticDao.preWebsiteListCount(website.getWesiteServiceId());//上个时段的量 用于与现在对比
if(preCount!=null){
map.put("preCount",preCount);
}else{
map.put("preCount",0);
}
result.add(map);
}
}
return result;
}
/**
*主题网站分类,域名
*
* **/
public List<Map> getTopicAndDomainList(){
//按照主题分类 获得主题
List<Map> topicList = trafficHttpStatisticDao.getDomainByTopicList();
if(topicList!=null&&topicList.size()>0){
for (Map m : topicList) {
List<Map> domainList= new ArrayList<Map>();
if(m!=null&&m.get("topicId")!=null){
domainList = trafficHttpStatisticDao.getDomainByTopicId(m.get("topicId"));
m.put("domainData", domainList);
}
}
}
return topicList;
}
}

View File

@@ -44,6 +44,7 @@ import net.sf.json.JSONObject;
@Service()
public class MaatTestServiceimpl {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private static final int TAPREDISDB = Configurations.getIntProperty("tapRedisDb", 5);
public void getMaatKeys(List<ConfigCompile> configCompileList) throws Exception {
if (configCompileList != null && configCompileList.size() > 0) {
@@ -51,9 +52,16 @@ public class MaatTestServiceimpl {
Integer service = configCompile.getService();
MaatXmlConfig maatXmlConfig = ReadMaatXmlUtil.getMaatConfigByService(service);
List<Integer> redisDBList = ServiceAndRDBIndexReal.getRedisDBByService(service);
if (ServiceAndRDBIndexReal.isAddASU(service)) {
if (!redisDBList.contains(TAPREDISDB)) {
throw new RuntimeException("业务类型:" + service + ",需要向阀门" + TAPREDISDB + "号库分发,但是当前只往"
+ redisDBList + "库下发,请检查阀门编号或者当前业务对应的配置文件是否正确");
}
}
for (Integer redisDB : redisDBList) {
getConfigByKey(redisDB, service, configCompile, maatXmlConfig);
}
}
}
@@ -152,6 +160,33 @@ public class MaatTestServiceimpl {
if (valStr != null && !valStr.trim().equals("")) {
if (!StringUtils.isEmpty(valStr) && valStr.trim().startsWith("[")) {
valStr = valStr.trim().replace("[", "").replace("]", "");
if (TAPREDISDB == redisDb && type != 10 && type != 11
&& valStr.toLowerCase().equals("op_time")) {// 域配置并且是op_time时在op_time前面添加如下内容
Map<String, String[]> map2 = ServiceAndRDBIndexReal.getMaatToValveMap().get(service);
if (map2 != null && map2.size() > 0) {
String[] arr = null;
if (type == 12) {// IP类
arr = map2.get("ipRegion");
} else if (type == 13) {// 数值类
arr = map2.get("numRegion");
} else if (type == 14) {// 字符串类
arr = map2.get("strRegion");
} else if (type == 15) {// 增强字符串类
arr = map2.get("strStrRegion");
} else if (type == 16) {// 文件摘要类
arr = map2.get("fileDigestRegion");
} else if (type == 17) {// 文件摘要类
arr = map2.get("fileLikeRegion");
} else if (type == 18) {// 文件摘要类
arr = map2.get("ipClientRange");
}
if (arr != null && arr.length > 0) {
for (String str : arr) {
valList.add(str.toLowerCase());
}
}
}
}
valList.add(valStr);
} else {
valList.add(valStr);
@@ -159,8 +194,8 @@ public class MaatTestServiceimpl {
}
}
String val = JedisUtils.get(key, redisDb);
FileUtils.addStrToFile("\t\t入库的key=" + key + "\n", Configurations.getStringProperty("maatTestLogPath", ""),
true);
FileUtils.addStrToFile("\t\t入库的key=" + key + "\n",
Configurations.getStringProperty("maatTestLogPath", ""), true);
FileUtils.addStrToFile("\t\t入库的val=" + val, Configurations.getStringProperty("maatTestLogPath", ""),
true);
FileUtils.addStrToFile("\t\t表达式" + maatXmlExpr.getValueExpression() + "\n",
@@ -171,11 +206,45 @@ public class MaatTestServiceimpl {
}
}
if (sysoLog(valArr, valList, obj, redisDb, key, configCompile, service)) {
if (TAPREDISDB == redisDb && type != 10 && type != 11) {// 域配置并且是op_time时在op_time前面添加如下内容
Map<String, String[]> map2 = ServiceAndRDBIndexReal.getMaatToValveMap().get(service);
if (map2 != null && map2.size() > 0) {
String[] arr = null;
if (type == 12) {// IP类
arr = map2.get("ipRegion");
} else if (type == 13) {// 数值类
arr = map2.get("numRegion");
} else if (type == 14) {// 字符串类
arr = map2.get("strRegion");
} else if (type == 15) {// 增强字符串类
arr = map2.get("strStrRegion");
} else if (type == 16) {// 文件摘要类
arr = map2.get("fileDigestRegion");
} else if (type == 17) {// 文件摘要类
arr = map2.get("fileLikeRegion");
} else if (type == 18) {// 文件摘要类
arr = map2.get("ipClientRange");
}
if (arr != null && arr.length > 0) {
StringBuffer sb = new StringBuffer();
for (String str : arr) {
sb.append(str.toLowerCase() + ",");
}
FileUtils.addStrToFile(
"\t" + sdf.format(new Date()) + " 编译配置id为" + compileId + "的配置中,在" + redisDb
+ "号redis库中key=" + key + "的值与实际插入的值相符(该库是阀门库并额外在optime字段前添加了两个字段"
+ sb.substring(0, sb.length() - 1) + ")\n",
Configurations.getStringProperty("maatTestLogPath", ""), true);
return;
}
}
}
FileUtils
.addStrToFile(
"\t" + sdf.format(new Date()) + " 编译配置id为" + compileId + "的配置中,在" + redisDb + "号redis库中key="
+ key + "的值与实际插入的值相符\n",
Configurations.getStringProperty("maatTestLogPath", ""), true);
}
}
@@ -433,8 +502,8 @@ public class MaatTestServiceimpl {
}
}
key = keyBF.toString().toUpperCase();
String[] valSplit = maatXmlExpr.getValueExpression().replace(";&nbsp;0;\\n", "").replace(";&nbsp", "\\t").replace("\\n", "").replace("\\t", "")
.split(";");
String[] valSplit = maatXmlExpr.getValueExpression().replace(";&nbsp;0;\\n", "").replace(";&nbsp", "\\t")
.replace("\\n", "").replace("\\t", "").split(";");
for (String valStr : valSplit) {
if (valStr != null && !valStr.trim().equals("")) {
if (!StringUtils.isEmpty(valStr) && valStr.trim().startsWith("[")) {
@@ -446,14 +515,13 @@ public class MaatTestServiceimpl {
}
}
String val = JedisUtils.get(key, redisDb).replace(" ", "\t");
FileUtils.addStrToFile("\t\t入库的key=" + key + "\n", Configurations.getStringProperty("maatTestLogPath", ""),
true);
FileUtils.addStrToFile("\t\t入库的val=" + val, Configurations.getStringProperty("maatTestLogPath", ""),
true);
FileUtils.addStrToFile("\t\t入库的val=" + val, Configurations.getStringProperty("maatTestLogPath", ""), true);
FileUtils.addStrToFile("\t\t表达式" + maatXmlExpr.getValueExpression() + "\n",
Configurations.getStringProperty("maatTestLogPath", ""), true);
valArr = val.split("\\t");
break;
}

View File

@@ -4,8 +4,8 @@ import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.nis.domain.restful.AbnormalMachine;
import com.nis.domain.restful.TrafficNmsServerStatistic;
import com.nis.web.dao.TrafficNmsServerStatisticDao;
@@ -14,16 +14,13 @@ public class TrafficNmsServerStatisticService {
@Autowired
TrafficNmsServerStatisticDao trafficNmsServerStatisticDao;
public TrafficNmsServerStatistic saveNmsServer(TrafficNmsServerStatistic trafficNmsServerStatistic) {
trafficNmsServerStatisticDao.insert(trafficNmsServerStatistic);
return trafficNmsServerStatistic;
}
public void saveAbnormalMachine(Integer id, List<AbnormalMachine> abnormalMachineList) {
trafficNmsServerStatisticDao.insertAbnormalMachine(id, abnormalMachineList);
}
public void delNmsServer(TrafficNmsServerStatistic trafficNmsServerStatistic) {
trafficNmsServerStatisticDao.delete(trafficNmsServerStatistic);
@Transactional
public void saveNmsInfo(List<TrafficNmsServerStatistic> trafficNmsServerList) {
for (TrafficNmsServerStatistic trafficNmsServerStatistic : trafficNmsServerList) {
trafficNmsServerStatisticDao.insert(trafficNmsServerStatistic);
trafficNmsServerStatisticDao.insertAbnormalMachine(trafficNmsServerStatistic.getId(),
trafficNmsServerStatistic.getAbnormalMachineList());
}
Integer.parseInt(null);
}
}

View File

@@ -176,19 +176,19 @@ service=1:128;2:128;16:16;17:16;18:16;19:16;20:16;21:16;22:16;23:16;24:16;26:16;
768=10:IR_POLICY_COMPILE;11:IR_POLICY_GROUP;12:IR_POLICY_IP;14:NTC_SUBSCRIBE_ID;18:NTC_IP_RANGE
#0x400 APP HTTP特征发现
1024=10:APP_COMPILE;11:APP_GROUP;14:APP_SUBSCRIBE_ID;15:APP_HTTP;18:NTC_IP_RANGE
#0x401 APP载荷特征表
1025=10:APP_COMPILE;11:APP_GROUP;12:APP_IP_RANGE;14:APP_SUBSCRIBE_ID;15:APP_PAYLOAD;18:NTC_IP_RANGE
#0x402 APP DOMAIN特征发现
1026=10:APP_COMPILE;11:APP_GROUP;14:APP_DOMAIN,APP_SUBSCRIBE_ID;18:NTC_IP_RANGE
#0x403 APP DNS特征匹配
1027=10:APP_COMPILE;11:APP_GROUP;14:APP_SUBSCRIBE_ID;15:APP_DNS;18:NTC_IP_RANGE
#0x404 APP IP特征
1028=10:APP_COMPILE;11:APP_GROUP;12:APP_STATIC_SEV_IP;14:APP_SUBSCRIBE_ID;18:NTC_IP_RANGE
#0x405 APP SSL特征
1029=10:APP_COMPILE;11:APP_GROUP;12:APP_IP_RANGE;14:APP_SUBSCRIBE_ID;15:APP_SSL;18:NTC_IP_RANGE
#0x406 APP多用途标签
1030=10:APP_COMPILE;11:APP_GROUP;14:APP_SUBSCRIBE_ID;15:APP_DK_GL;18:NTC_IP_RANGE
1024=10:APP_COMPILE;11:APP_GROUP;15:APP_HTTP;12:APP_IP_RANGE
#0x401 APP载荷特征表
1025=10:APP_COMPILE;11:APP_GROUP;12:APP_IP_RANGE;15:APP_PAYLOAD
#0x402 APP DOMAIN特征发现
1026=10:APP_COMPILE;11:APP_GROUP;14:APP_DOMAIN
#0x403 APP DNS特征匹配
1027=10:APP_COMPILE;11:APP_GROUP;15:APP_DNS
#0x404 APP IP特征
1028=10:APP_COMPILE;11:APP_GROUP;12:APP_STATIC_SEV_IP
#0x405 APP SSL特征
1029=10:APP_COMPILE;11:APP_GROUP;12:APP_IP_RANGE;15:APP_SSL
#0x406 APP多用途标签
1030=10:APP_COMPILE;11:APP_GROUP;14:APP_DK_GL
#0x410 APP丢弃
1040=10:APP_COMPILE;11:APP_GROUP;12:NTC_UNIVERSAL_IP;13:NTC_UNIVERSAL_PROTO_TYPE;14:APP_POLICY,APP_SUBSCRIBE_ID;18:NTC_IP_RANGE
@@ -296,7 +296,8 @@ unMaatService=3:32;4:96;5:32;25:32;28:32;64;65;261:16;262:16;263:16;264:16;265:1
##########
serviceDBIndex=1:2,3,4,5;2:2,3,4,5;16:2;17:2;18:2;19:2;20:2;21:2;22:2;23:2;24:2;26:2;27:2;30:2;31:2;32:2;33:2,5;34:2;35:2;36:2;37:2;128:2;129:2;130:2;131:2;132:2;133:2;134:2;135:2;136:2;137:2;138:2;139:2;140:2;142:2;143:2;144:2;145:2;146:2;147:2;148:2;149:2;256:2;257:2;258:2;259:2;260:2;267:2;271:2;272:2;384:2;385:2;386:2;387:2;388:2;395:2;512:4,5;513:4,2,5;514:4;515:4;517:4;520:4;521:4;528:4;544:4;560:4;576:4;592:4;608:4;750:4;768:4;1024:2;1025:2;1026:2,5;1027:2;1028:2,5;1029:2;1030:2;1040:2;1041:2;1042:2;1152:2;3:5;4:5;5:2;25:5;28:5;64:2;65:2;261:3;262:3;263:3;264:3;265:2;266:2;268:3;269:3;270:3;389:3;390:3;391:3;392:3;393:2;394:2;396:3;397:3;398:3;832:2,4,5;
##阀门配置在redisdb的序号
tapRedisDb=5
##maat配置入阀门需要将编译中的部分参数写到域配置中目前最多包含ACTIONSERVICEUSER_REGION三个属性
##业务ID:域类型1|域类型2@属性1&属性2&属性3
##域类型IP域 =ipRegion 字符串域=strRegion 增强字符串域=strStrRegion 数值域=numRegion

View File

@@ -176,19 +176,19 @@ service=1:128;2:128;16:16;17:16;18:16;19:16;20:16;21:16;22:16;23:16;24:16;26:16;
768=10:IR_POLICY_COMPILE;11:IR_POLICY_GROUP;12:IR_POLICY_IP;14:NTC_SUBSCRIBE_ID;18:NTC_IP_RANGE
#0x400 APP HTTP特征发现
1024=10:APP_COMPILE;11:APP_GROUP;14:APP_SUBSCRIBE_ID;15:APP_HTTP;18:NTC_IP_RANGE
#0x401 APP载荷特征表
1025=10:APP_COMPILE;11:APP_GROUP;12:APP_IP_RANGE;14:APP_SUBSCRIBE_ID;15:APP_PAYLOAD;18:NTC_IP_RANGE
#0x402 APP DOMAIN特征发现
1026=10:APP_COMPILE;11:APP_GROUP;14:APP_DOMAIN,APP_SUBSCRIBE_ID;18:NTC_IP_RANGE
#0x403 APP DNS特征匹配
1027=10:APP_COMPILE;11:APP_GROUP;14:APP_SUBSCRIBE_ID;15:APP_DNS;18:NTC_IP_RANGE
#0x404 APP IP特征
1028=10:APP_COMPILE;11:APP_GROUP;12:APP_STATIC_SEV_IP;14:APP_SUBSCRIBE_ID;18:NTC_IP_RANGE
#0x405 APP SSL特征
1029=10:APP_COMPILE;11:APP_GROUP;12:APP_IP_RANGE;14:APP_SUBSCRIBE_ID;15:APP_SSL;18:NTC_IP_RANGE
#0x406 APP多用途标签
1030=10:APP_COMPILE;11:APP_GROUP;14:APP_SUBSCRIBE_ID;15:APP_DK_GL;18:NTC_IP_RANGE
1024=10:APP_COMPILE;11:APP_GROUP;15:APP_HTTP;12:APP_IP_RANGE
#0x401 APP载荷特征表
1025=10:APP_COMPILE;11:APP_GROUP;12:APP_IP_RANGE;15:APP_PAYLOAD
#0x402 APP DOMAIN特征发现
1026=10:APP_COMPILE;11:APP_GROUP;14:APP_DOMAIN
#0x403 APP DNS特征匹配
1027=10:APP_COMPILE;11:APP_GROUP;15:APP_DNS
#0x404 APP IP特征
1028=10:APP_COMPILE;11:APP_GROUP;12:APP_STATIC_SEV_IP
#0x405 APP SSL特征
1029=10:APP_COMPILE;11:APP_GROUP;12:APP_IP_RANGE;15:APP_SSL
#0x406 APP多用途标签
1030=10:APP_COMPILE;11:APP_GROUP;14:APP_DK_GL
#0x410 APP丢弃
1040=10:APP_COMPILE;11:APP_GROUP;12:NTC_UNIVERSAL_IP;13:NTC_UNIVERSAL_PROTO_TYPE;14:APP_POLICY,APP_SUBSCRIBE_ID;18:NTC_IP_RANGE
@@ -281,7 +281,8 @@ unMaatService=3:32;4:96;5:32;25:32;28:32;64;65;261:16;262:16;263:16;264:16;265:1
##各业务类型对应的redisdb,业务类型:redisdb,多个业务以“;”分隔,多个db以“,”数量不能超过6个
#系统简称对应的redisDBIndex: NTC(12-55):2 MM(256-511):3 PXY(512-767):4 IR(768-1023):5 DK(10241279):6 阀门:7
serviceDBIndex=1:2,3,4,6,7;2:2,3,4,6,7;16:2;17:2;18:2;19:2;20:2;21:2;22:2;23:2;24:2;26:2;27:2;30:2;31:2;32:2;33:2,6,7;34:2;35:2,6;36:2,6;37:2;128:2;129:2;130:2;131:2;132:2;133:2;134:2;135:2;136:2;137:2;138:2;139:2;140:2;141:2;142:2;143:2;144:2;145:2,6;146:2;147:2,6;148:2,6;149:2;256:3;257:3;258:3;259:3;260:3;267:3;384:3;385:3;386:3;387:3;388:3;395:3;512:4,7;513:4,2,7;514:4;515:4;517:4;520:4;521:4;528:4;544:4;560:4;576:4;592:4;608:4;750:4;768:5;1024:2,6,7;1025:2,6,7;1026:2,6,7;1027:2,6,7;1028:2,6,7;1029:2,6,7;1030:2,6,7;1031:2,6,7;1040:2,6,7;1041:2,6,7;1042:2,6,7;1152:2,6;3:7;4:7;5:2;25:7;28:7;64:2;65:2;261:8,12;262:9,12;263:10,12;264:11,12;265:3;266:3;268:12;269:12;270:12;389:8,12;390:9,12;391:10,12;392:11,12;393:3;394:3;396:12;397:12;398:12;832:2,4,5,7;
##阀门配置在redisdb的序号
tapRedisDb=7
##maat配置入阀门需要将编译中的部分参数写到域配置中目前最多包含ACTIONSERVICEUSER_REGION三个属性
##业务ID:域类型1|域类型2@属性1&属性2&属性3
##域类型IP域 =ipRegion 字符串域=strRegion 增强字符串域=strStrRegion 数值域=numRegion
@@ -301,6 +302,7 @@ serviceDBIndex=1:2,3,4,6,7;2:2,3,4,6,7;16:2;17:2;18:2;19:2;20:2;21:2;22:2;23:2;2
maat2Valve=33:strRegion@ACTION&SERVICE&USER_REGION;35:strRegion@ACTION&SERVICE&USER_REGION;36:strRegion@ACTION&SERVICE&USER_REGION;145:strRegion@ACTION&SERVICE&USER_REGION;147:strRegion@ACTION&SERVICE&USER_REGION;148:strRegion@ACTION&SERVICE&USER_REGION;512:ipRegion@ACTION&SERVICE;513:strRegion@ACTION&SERVICE&USER_REGION;1024:strRegion|strStrRegion@USER_REGION;1026:strRegion|strStrRegion@USER_REGION;1027:strRegion|strStrRegion@USER_REGION;1028:ipRegion@USER_REGION;1029:strStrRegion@USER_REGION;1030:numRegion@USER_REGION;1031:strStrRegion@USER_REGION;1040:strRegion@ACTION&SERVICE&USER_REGION;1041:strRegion@ACTION&SERVICE&USER_REGION;1042:strRegion@ACTION&SERVICE&USER_REGION;1056:strRegion@ACTION&SERVICE&USER_REGION;1057:ipRegion@ACTION&SERVICE&USER_REGION;1058:strRegion@ACTION&SERVICE&USER_REGION;1059:strRegion@ACTION&SERVICE&USER_REGION;1060:strRegion@ACTION&SERVICE&USER_REGION
##记录哪些service可以被分组复用(只有maat类配置可以被分组复用)
#业务ID:域类型1@表名,表名|域类型2@表名;业务ID:域类型1@表名,表名|域类型2@表名
##域类型IP域 =ipRegion 字符串域=strRegion 数值域=numRegion

View File

@@ -176,19 +176,19 @@ service=1:128;2:128;16:16;17:16;18:16;19:16;20:16;21:16;22:16;23:16;24:16;26:16;
768=10:IR_POLICY_COMPILE;11:IR_POLICY_GROUP;12:IR_POLICY_IP;14:NTC_SUBSCRIBE_ID;18:NTC_IP_RANGE
#0x400 APP HTTP特征发现
1024=10:APP_COMPILE;11:APP_GROUP;14:APP_SUBSCRIBE_ID;15:APP_HTTP;18:NTC_IP_RANGE
#0x401 APP载荷特征表
1025=10:APP_COMPILE;11:APP_GROUP;12:APP_IP_RANGE;14:APP_SUBSCRIBE_ID;15:APP_PAYLOAD;18:NTC_IP_RANGE
#0x402 APP DOMAIN特征发现
1026=10:APP_COMPILE;11:APP_GROUP;14:APP_DOMAIN,APP_SUBSCRIBE_ID;18:NTC_IP_RANGE
#0x403 APP DNS特征匹配
1027=10:APP_COMPILE;11:APP_GROUP;14:APP_SUBSCRIBE_ID;15:APP_DNS;18:NTC_IP_RANGE
#0x404 APP IP特征
1028=10:APP_COMPILE;11:APP_GROUP;12:APP_STATIC_SEV_IP;14:APP_SUBSCRIBE_ID;18:NTC_IP_RANGE
#0x405 APP SSL特征
1029=10:APP_COMPILE;11:APP_GROUP;12:APP_IP_RANGE;14:APP_SUBSCRIBE_ID;15:APP_SSL;18:NTC_IP_RANGE
#0x406 APP多用途标签
1030=10:APP_COMPILE;11:APP_GROUP;14:APP_SUBSCRIBE_ID;15:APP_DK_GL;18:NTC_IP_RANGE
1024=10:APP_COMPILE;11:APP_GROUP;15:APP_HTTP;12:APP_IP_RANGE
#0x401 APP载荷特征表
1025=10:APP_COMPILE;11:APP_GROUP;12:APP_IP_RANGE;15:APP_PAYLOAD
#0x402 APP DOMAIN特征发现
1026=10:APP_COMPILE;11:APP_GROUP;14:APP_DOMAIN
#0x403 APP DNS特征匹配
1027=10:APP_COMPILE;11:APP_GROUP;15:APP_DNS
#0x404 APP IP特征
1028=10:APP_COMPILE;11:APP_GROUP;12:APP_STATIC_SEV_IP
#0x405 APP SSL特征
1029=10:APP_COMPILE;11:APP_GROUP;12:APP_IP_RANGE;15:APP_SSL
#0x406 APP多用途标签
1030=10:APP_COMPILE;11:APP_GROUP;14:APP_DK_GL
#0x410 APP丢弃
1040=10:APP_COMPILE;11:APP_GROUP;12:NTC_UNIVERSAL_IP;13:NTC_UNIVERSAL_PROTO_TYPE;14:APP_POLICY,APP_SUBSCRIBE_ID;18:NTC_IP_RANGE
@@ -296,7 +296,8 @@ unMaatService=3:32;4:96;5:32;25:32;28:32;64;65;261:16;262:16;263:16;264:16;265:1
##########
serviceDBIndex=1:2,3,4,5;2:2,3,4,5;16:2;17:2;18:2;19:2;20:2;21:2;22:2;23:2;24:2;26:2;27:2;30:2;31:2;32:2;33:2,5;34:2;35:2;36:2;37:2;128:2;129:2;130:2;131:2;132:2;133:2;134:2;135:2;136:2;137:2;138:2;139:2;140:2;142:2;143:2;144:2;145:2;146:2;147:2;148:2;149:2;256:2;257:2;258:2;259:2;260:2;267:2;271:2;272:2;384:2;385:2;386:2;387:2;388:2;395:2;512:4,5;513:4,2,5;514:4;515:4;517:4;520:4;521:4;528:4;544:4;560:4;576:4;592:4;608:4;750:4;768:4;1024:2;1025:2;1026:2,5;1027:2;1028:2,5;1029:2;1030:2;1040:2;1041:2;1042:2;1152:2;3:5;4:5;5:2;25:5;28:5;64:2;65:2;261:8;262:9;263:10;264:11;265:2;266:2;268:3;269:3;270:3;389:8;390:9;391:10;392:11;393:2;394:2;396:3;397:3;398:3;832:2,4,5;
##阀门配置在redisdb的序号
tapRedisDb=5
##maat配置入阀门需要将编译中的部分参数写到域配置中目前最多包含ACTIONSERVICEUSER_REGION三个属性
##业务ID:域类型1|域类型2@属性1&属性2&属性3
##域类型IP域 =ipRegion 字符串域=strRegion 增强字符串域=strStrRegion 数值域=numRegion

View File

@@ -10,11 +10,11 @@ fastdfs.http_secret_key = FastDFS1234567890
fastdfs.http_tracker_http_port = 80
#元辰鑫内网
#fastdfs.tracker_servers = 10.0.6.249:22122
#fastDfsHttpAddr= 10.0.6.249
fastdfs.tracker_servers = 10.0.6.249:22122
fastDfsHttpAddr= 10.0.6.249
#元辰鑫外网
fastdfs.tracker_servers = 192.168.10.205:22122
fastDfsHttpAddr=192.168.10.205
#fastdfs.tracker_servers=192.168.10.205:22122
#fastDfsHttpAddr=192.168.10.205
#亦庄演示环境
#fastdfs.tracker_servers = 10.3.34.1:22122
#fastDfsHttpAddr = 10.3.34.1

View File

@@ -7,8 +7,8 @@ http.secret_key = FastDFS1234567890
#元辰鑫内网
#tracker_server = 10.0.6.249:22122
tracker_server=10.0.6.249:22122
#元辰鑫外网
tracker_server = 192.168.10.205:22122
#tracker_server=192.168.10.205:22122
#亦庄演示环境
#tracker_server = 10.3.34.1:22122
#tracker_server=10.3.34.1:22122

View File

@@ -6,8 +6,6 @@ jdbc.log.url=jdbc:mysql://10.0.6.249:3306/galaxy?useUnicode=true&characterEncodi
#jdbc.log.url=jdbc:mysql://192.168.11.242:3306/galaxy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
#元辰鑫外网
#jdbc.log.url=jdbc:mysql://192.168.10.204:3306/galaxy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
#亦庄测试环境
#jdbc.log.url=jdbc:mysql://192.168.10.212:3306/galaxy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
#亦庄演示环境
#jdbc.log.url=jdbc:mysql://10.3.48.5:3306/galaxy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
jdbc.log.username=root
@@ -39,7 +37,8 @@ bonecp.statementsCacheSize=100
############################################################################################################################################
#数据中心hive接口配置
############################################################################################################################################
#数据中心hive日志库数据库名称,程序中每次查询时使用的数据库名称 use dbName
jdbc.hive.DBName=maat
#A版日志库
jdbc.hive.driver=org.apache.hive.jdbc.HiveDriver
#元辰鑫内网
@@ -48,10 +47,6 @@ jdbc.hive.url=jdbc:hive2://10.0.6.202:10000/maat
#jdbc.hive.url=jdbc:hive2://192.168.11.243:2181,192.168.10.76:2181,192.168.10.77:2181/maat;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2
#元辰鑫外网
#jdbc.hive.url=jdbc:hive2://192.168.10.22:10000/maat
#亦庄测试环境
#jdbc.hive.url=jdbc:hive2://192.168.10.216:10000/maat
#亦庄测试环境高可用集群连接,注意使用此种方法需要配置hosts,主机名与ip的对应关系
#jdbc.hive.url=jdbc:hive2://192.168.10.216:2181,192.168.10.217:2181,192.168.10.218:2181/maat;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2
#亦庄演示环境高可用集群连接,注意使用此种方法需要配置hosts,主机名与ip的对应关系
#jdbc.hive.url=jdbc:hive2://10.3.48.2:2181,10.3.48.3:2181,10.3.48.4:2181/maat;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2
jdbc.hive.username=xa_z2_mesa
@@ -72,11 +67,15 @@ bonecp.hive.statementsCacheSize=100
#################日志查询clickhouse数据源信息#############
#日志查询是否使用clickhouse,否则使用hive
isUseClickHouse=false
##clickhouse数据库名称
jdbc.clickHouse.DBName=k18_ods
jdbc.clickhouse.driver=ru.yandex.clickhouse.ClickHouseDriver
#域名测试环境
jdbc.clickhouse.url=jdbc:clickhouse://clickhouse.baifendian.com:80/k18_ods
#jdbc.clickhouse.url=jdbc:clickhouse://clickhouse.baifendian.com:80/k18_ods
#亦庄演示环境
#jdbc.clickhouse.url=jdbc:clickhouse://10.3.45.5:8123/k18_ods
jdbc.clickhouse.url=jdbc:clickhouse://10.3.45.5:8123/k18_ods
jdbc.clickhouse.username=
jdbc.clickhouse.key=
jdbc.clickhouse.password=
@@ -153,7 +152,7 @@ redis.maxTotal=250
redis.maxWaitMillis=100000
redis.testOnBorrow=true
redis.testOnReturn=true
#客户端超时时间单位是毫秒
#客户端超时时间单位是毫秒
redis.timeout=100000
#用于 redis.clients.jedis.JedisCluster.JedisCluster(Set<HostAndPort>, int, int, GenericObjectPoolConfig) 第三个参数 maxRedirections
#默认值是5

View File

@@ -137,20 +137,12 @@ isSelectCluster=true
#用户查询日志超过多少小时去数据中心查询
dataCenterTime=48
#是否开启基础验证
baseValidate=true
#是否开启业务验证
serviceValidate=true
#\u65E5\u5FD7\u5B58\u50A8\u672C\u5730\u65F6\u95F4(\u5355\u4F4D\u5C0F\u65F6)
logLocalTime=48
#\u5B9E\u65F6\u7EDF\u8BA1\u9ED8\u8BA4\u67E5\u8BE2\u672C\u5730\u4E00\u4E2A\u5C0F\u65F6\u7684\u6570\u636E(\u5355\u4F4D\uFF1A\u5C0F\u65F6)
reportLocalTime=1
#实时报表统计时间,单位:分钟
pzReportTime=5
#\u795E\u901A\u6570\u636E\u5E93\u6700\u65E9\u65E5\u5FD7\u65F6\u95F4(A\u7248\u6BEB\u79D2)
#2017-08-13 10:07:25
@@ -168,24 +160,26 @@ httpUrl=http://127.0.0.1:8080/galaxy/service/cfg/v1/configSources
#use elasticsearch or not#
isUseES=false
####galaxy 使用########################################################################################################################################
#是否开启基础验证
baseValidate=true
#是否开启业务验证
serviceValidate=true
#日志查询是否使用clickhouse,否则使用hive
isUseClickHouse=false
##clickhouse数据库名称
jdbc.clickHouse.DBName=k18_ods
#数据中心hive日志库数据库名称,程序中每次查询时使用的数据库名称 use dbName
jdbc.hive.DBName=maat
maxPageSize=100000
#是否开启Debug模式
isDebug=true
#实时报表统计时间,单位:分钟
pzReportTime=5
#文件摘要获取工具目录
digest.gen.tool.path=maat-redis/digest_gen
@@ -196,8 +190,6 @@ maxRedisDBIndex=16
idRelaRedisDBIndex=15
#存储分组复用域配置的redisdb
tmpStorageReuseRegionDB=15
##阀门配置在redisdb的序号
tapRedisDb=7
##实时统计(编译配置)数据表达式
redisStatisticsReal=[COMPILE_ID];\t;[SERVICE];\t;[ACTION];\t;[CONT_TYPE];\t;[ATTR_TYPE];\t;[CONT_LABEL];\t;[TASK_ID];\t;[AFFAIR_ID];\t;[DO_BLACKLIST];\t;[DO_LOG];\t;[EFFECTIVE_RANGE];\t;[START_TIME];\t;[END_TIME];\t;[USER_REGION];\t;[IS_VALID];\t;[GROUP_NUM];\t;[FATHER_CFG_ID];\t;[OP_TIME]
@@ -205,6 +197,7 @@ redisStatisticsReal=[COMPILE_ID];\t;[SERVICE];\t;[ACTION];\t;[CONT_TYPE];\t;[ATT
redisStatisticsRealDBIndex=14
#maat测试程序输出日志的文件目录
maatTestLogPath=c:/maat/mmat.log
#maatTestLogPath=/home/maat/mmat.log
#样例文件存放目录,{tableType}和{fileName}会替换成具体内容
mmSampleDstPath=/home/mesasoft/{tableType}/full/{fileName}