1、增加debug信息开关
2、修正DETECTION_INFO_WARNING insert语句
This commit is contained in:
@@ -314,7 +314,7 @@ public class DetectInfo {
|
|||||||
*/
|
*/
|
||||||
public static String getInsertWarningSql(){
|
public static String getInsertWarningSql(){
|
||||||
//插入warning表
|
//插入warning表
|
||||||
String insertWaringSql = "INSERT INTO DETECTION_INFO_WARNING (ID, DETECTION_SET_INFO_ID, DETECTION_STATE_INFO, " +
|
String insertWaringSql = "INSERT INTO DETECTION_INFO_WARNING (DETECTION_INFO_ID, DETECTION_SET_INFO_ID, DETECTION_STATE_INFO, " +
|
||||||
"PERFORMACE_DATA, CURRENT_TIMES, START_TIME, DELAY_TIME, NEXT_CHECK_TIME, " +
|
"PERFORMACE_DATA, CURRENT_TIMES, START_TIME, DELAY_TIME, NEXT_CHECK_TIME, " +
|
||||||
"POLICE_LEVEL, DATA_CHECK_TIME, DATA_ARRIVE_TIME, DETECTIONED_STATE, " +
|
"POLICE_LEVEL, DATA_CHECK_TIME, DATA_ARRIVE_TIME, DETECTIONED_STATE, " +
|
||||||
"DATA_CHECK_TIME_DIGITAL, DATA_ARRIVE_TIME_DIGITAL, SEQ_ID, POLICE_EMERGENT)"
|
"DATA_CHECK_TIME_DIGITAL, DATA_ARRIVE_TIME_DIGITAL, SEQ_ID, POLICE_EMERGENT)"
|
||||||
|
|||||||
@@ -500,7 +500,9 @@ public class Common {
|
|||||||
logger.debug("监测数据 添加到 集合2");
|
logger.debug("监测数据 添加到 集合2");
|
||||||
deteDataList2.add(dsb); }
|
deteDataList2.add(dsb); }
|
||||||
}*/
|
}*/
|
||||||
logger.debug(new String(dsb));
|
if(Constants.DEBUG_COMMON_ADDDETEDATA) {
|
||||||
|
logger.debug(new String(dsb));
|
||||||
|
}
|
||||||
DETE_DATA_QUEUE.add(dsb);
|
DETE_DATA_QUEUE.add(dsb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -487,6 +487,17 @@ public class Constants {
|
|||||||
* 是否开启 client 请求连接限制,默认 true
|
* 是否开启 client 请求连接限制,默认 true
|
||||||
*/
|
*/
|
||||||
public static final boolean SERVER_ACCEPT_SEMAPHORE_FLAG;
|
public static final boolean SERVER_ACCEPT_SEMAPHORE_FLAG;
|
||||||
|
|
||||||
|
public static final boolean DEBUG_COMMON_ADDDETEDATA;
|
||||||
|
public static final boolean DEBUG_MESSAGEDECODER_DECODE;
|
||||||
|
public static final boolean DEBUG_DETECTINFOINSERTTHREAD_ADDRECORDTOSTATEMENT;
|
||||||
|
public static final boolean DEBUG_DETECTDETAILINSERTTHREAD_SAVETODB;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 端口监测 流量为 0 告警
|
||||||
|
*/
|
||||||
|
public static final boolean PORT_ZERO_WARNING_FLAG;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
||||||
// InetAddress inetAddress = null;
|
// InetAddress inetAddress = null;
|
||||||
@@ -863,6 +874,16 @@ public class Constants {
|
|||||||
* 是否开启 client 连接数限制
|
* 是否开启 client 连接数限制
|
||||||
*/
|
*/
|
||||||
SERVER_ACCEPT_SEMAPHORE_FLAG = Config.getBoolan("server.accept.semaphore.flag", true);
|
SERVER_ACCEPT_SEMAPHORE_FLAG = Config.getBoolan("server.accept.semaphore.flag", true);
|
||||||
|
|
||||||
|
|
||||||
|
//是否开启debug日志输出
|
||||||
|
DEBUG_COMMON_ADDDETEDATA = Config.getBoolan("DEBUG_COMMON_ADDDETEDATA", false);
|
||||||
|
DEBUG_MESSAGEDECODER_DECODE = Config.getBoolan("DEBUG_MESSAGEDECODER_DECODE", false);
|
||||||
|
DEBUG_DETECTINFOINSERTTHREAD_ADDRECORDTOSTATEMENT = Config.getBoolan("DEBUG_DETECTINFOINSERTTHREAD_ADDRECORDTOSTATEMENT", false);
|
||||||
|
DEBUG_DETECTDETAILINSERTTHREAD_SAVETODB = Config.getBoolan("DEBUG_DETECTDETAILINSERTTHREAD_SAVETODB", false);
|
||||||
|
|
||||||
|
// 端口流量为 0 告警 功能
|
||||||
|
PORT_ZERO_WARNING_FLAG = Config.getBoolan("port.zero.warning.flag", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//文件传输 临时文件命名后缀
|
//文件传输 临时文件命名后缀
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import java.util.Queue;
|
|||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import com.alibaba.druid.support.json.JSONUtils;
|
||||||
import com.fang.lang.Db;
|
import com.fang.lang.Db;
|
||||||
import com.nms.server.bean.AlarmInfo;
|
import com.nms.server.bean.AlarmInfo;
|
||||||
import com.nms.server.bean.DetectInfo;
|
import com.nms.server.bean.DetectInfo;
|
||||||
@@ -846,6 +847,7 @@ public class DataResolveThread implements Runnable{
|
|||||||
//--基本信息解析 存在异常值 无须保存,返回错误信息 用于系统告警
|
//--基本信息解析 存在异常值 无须保存,返回错误信息 用于系统告警
|
||||||
if(errorInfo.length() != 0){
|
if(errorInfo.length() != 0){
|
||||||
logger.error(" 第一步-1: 新格式监测数据解析异常: seqId:"+seqId+",setInfoId:"+setInfoId+",checkType:"+checkType+" checkTime:"+new Date(checkTime)+" 监测数据解析异常:"+errorInfo);
|
logger.error(" 第一步-1: 新格式监测数据解析异常: seqId:"+seqId+",setInfoId:"+setInfoId+",checkType:"+checkType+" checkTime:"+new Date(checkTime)+" 监测数据解析异常:"+errorInfo);
|
||||||
|
logger.error("错误数据内容如下 : "+JSONUtils.toJSONString(strsList));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1024,15 +1026,15 @@ public class DataResolveThread implements Runnable{
|
|||||||
detailDetectionState = "0";//当前端口的状态
|
detailDetectionState = "0";//当前端口的状态
|
||||||
pLevel = Constants.PORT_ALARM_LEVEL;//非界面设置,默认为5级
|
pLevel = Constants.PORT_ALARM_LEVEL;//非界面设置,默认为5级
|
||||||
}
|
}
|
||||||
|
//2018年12月3日18:11:57 添加开关,可以控制是否开启流量为 0 告警功能
|
||||||
if("1".equals(detailDetectionState)) {//如果当前端口的状态正常,才需要判断流量是否为0
|
if("1".equals(detailDetectionState) && Constants.PORT_ZERO_WARNING_FLAG) {//如果当前端口的状态正常,才需要判断流量是否为0
|
||||||
double inOctetsSpeed = detailsArr0[25]==null?0d:("".equals(detailsArr0[25])?0d:Double.parseDouble(detailsArr0[25].trim()));//23+2=25,瞬时输入字节速度
|
double inOctetsSpeed = detailsArr0[25]==null?0d:("".equals(detailsArr0[25])?0d:Double.parseDouble(detailsArr0[25].trim()));//23+2=25,瞬时输入字节速度
|
||||||
double outOctetsSpeed = detailsArr0[29]==null?0d:("".equals(detailsArr0[29])?0d:Double.parseDouble(detailsArr0[29].trim()));//27+2=29,瞬时输出字节速度
|
double outOctetsSpeed = detailsArr0[29]==null?0d:("".equals(detailsArr0[29])?0d:Double.parseDouble(detailsArr0[29].trim()));//27+2=29,瞬时输出字节速度
|
||||||
logger.info("test:port:inOctetsSpeed="+inOctetsSpeed+";outOctetsSpeed="+outOctetsSpeed);
|
logger.info("test:port:inOctetsSpeed="+inOctetsSpeed+";outOctetsSpeed="+outOctetsSpeed);
|
||||||
if((inOctetsSpeed+outOctetsSpeed)<=0) {
|
if((inOctetsSpeed+outOctetsSpeed)<=0) {
|
||||||
state = 0;//监测公共信息的状态
|
state = 0;//监测公共信息的状态
|
||||||
// dsinfo += "$@$端口"+ifDescr+"异常(流量为0),inOctetsSpeed="+inOctetsSpeed+",outOctetsSpeed="+outOctetsSpeed+",sum="+(inOctetsSpeed+outOctetsSpeed);
|
// dsinfo += "$@$端口"+ifDescr+"异常(流量为0),inOctetsSpeed="+inOctetsSpeed+",outOctetsSpeed="+outOctetsSpeed+",sum="+(inOctetsSpeed+outOctetsSpeed);
|
||||||
dsinfo += "i18n_server.CommonService.dsinfo1_n81i"+ifDescr+"i1n8_server.CommonService.dsinfo1.exception_n81i,inOctetsSpeed="+inOctetsSpeed+",outOctetsSpeed="+outOctetsSpeed+",sum="+(inOctetsSpeed+outOctetsSpeed);
|
dsinfo += "i18n_server.CommonService.dsinfo1_n81i"+ifDescr+"i18n_server.CommonService.dsinfo1.exception_n81i,inOctetsSpeed="+inOctetsSpeed+",outOctetsSpeed="+outOctetsSpeed+",sum="+(inOctetsSpeed+outOctetsSpeed);
|
||||||
detailDetectionState = "0";//当前端口的状态
|
detailDetectionState = "0";//当前端口的状态
|
||||||
pLevel = Constants.PORT_ALARM_LEVEL;//非界面设置,默认为5级
|
pLevel = Constants.PORT_ALARM_LEVEL;//非界面设置,默认为5级
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,7 +168,9 @@ public class DetectDetailInsertThread implements Runnable{
|
|||||||
int count=0;
|
int count=0;
|
||||||
for(Object[] e : params){
|
for(Object[] e : params){
|
||||||
arrTemp=e;
|
arrTemp=e;
|
||||||
logger.debug(" params " + Arrays.toString(e)+"addToBatch :"+ ++count);
|
if(Constants.DEBUG_DETECTDETAILINSERTTHREAD_SAVETODB) {
|
||||||
|
logger.debug(" params " + Arrays.toString(e)+"addToBatch :"+ ++count);
|
||||||
|
}
|
||||||
for (int i = 0; i < e.length; i++) {
|
for (int i = 0; i < e.length; i++) {
|
||||||
Object value = e[i];
|
Object value = e[i];
|
||||||
temp=value;
|
temp=value;
|
||||||
|
|||||||
@@ -249,6 +249,7 @@ public class DetectInfoInsertThread implements Runnable {
|
|||||||
int emailCount = 0;
|
int emailCount = 0;
|
||||||
Map<String,Long> statusChangeMap = U.newHashMap();
|
Map<String,Long> statusChangeMap = U.newHashMap();
|
||||||
boolean emailFlag = Constants.flag_email == 1;// 是否启用 email
|
boolean emailFlag = Constants.flag_email == 1;// 是否启用 email
|
||||||
|
logger.info(emailFlag?"邮件功能開啟" : "邮件功能已关闭");
|
||||||
Iterator<Object[]> ite = infoList.iterator();
|
Iterator<Object[]> ite = infoList.iterator();
|
||||||
while (ite.hasNext()) {
|
while (ite.hasNext()) {
|
||||||
temInfo = ite.next();
|
temInfo = ite.next();
|
||||||
@@ -332,7 +333,7 @@ public class DetectInfoInsertThread implements Runnable {
|
|||||||
|
|
||||||
// 添加邮件信息
|
// 添加邮件信息
|
||||||
if (!emailFlag) {
|
if (!emailFlag) {
|
||||||
logger.info("邮件功能已关闭");
|
|
||||||
} else {
|
} else {
|
||||||
if ((Boolean) temInfo[DetectInfo.SENDEMAILFLAG]) {
|
if ((Boolean) temInfo[DetectInfo.SENDEMAILFLAG]) {
|
||||||
EmailInfo emailInfo = (EmailInfo) temInfo[DetectInfo.EMAILINFO];
|
EmailInfo emailInfo = (EmailInfo) temInfo[DetectInfo.EMAILINFO];
|
||||||
@@ -881,7 +882,9 @@ public class DetectInfoInsertThread implements Runnable {
|
|||||||
*/
|
*/
|
||||||
private void addRecordToStatement(PreparedStatement stmt, Object[] params) throws SQLException {
|
private void addRecordToStatement(PreparedStatement stmt, Object[] params) throws SQLException {
|
||||||
if (params != null) {
|
if (params != null) {
|
||||||
logger.debug(" params " + Arrays.toString(params));
|
if(Constants.DEBUG_DETECTINFOINSERTTHREAD_ADDRECORDTOSTATEMENT) {
|
||||||
|
logger.debug(" params " + Arrays.toString(params));
|
||||||
|
}
|
||||||
for (int i = 0; i < params.length; i++) {
|
for (int i = 0; i < params.length; i++) {
|
||||||
stmt.setObject(i + 1, params[i]);
|
stmt.setObject(i + 1, params[i]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import com.nms.server.common.Constants;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
@@ -101,14 +103,18 @@ public class MessageDecoder extends ByteToMessageDecoder {
|
|||||||
if(m != null){
|
if(m != null){
|
||||||
out.add(m);
|
out.add(m);
|
||||||
init();
|
init();
|
||||||
logger.debug("成功组包一条消息:type : " +m.getBusinessType().getName() +",length : " + m.getLength());
|
if(Constants.DEBUG_MESSAGEDECODER_DECODE) {
|
||||||
|
logger.debug("成功组包一条消息:type : " +m.getBusinessType().getName() +",length : " + m.getLength());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Message decode(ByteBuf in) throws Exception{
|
private Message decode(ByteBuf in) throws Exception{
|
||||||
int readableBytes = in.readableBytes();
|
int readableBytes = in.readableBytes();
|
||||||
logger.debug("decode begin,flag:"+flag+ " ,readableBytes:" + readableBytes);
|
if(Constants.DEBUG_MESSAGEDECODER_DECODE) {
|
||||||
|
logger.debug("decode begin,flag:"+flag+ " ,readableBytes:" + readableBytes);
|
||||||
|
}
|
||||||
if(flag && readableBytes < (headerLength)){//初始状态,且不能读取 协议头
|
if(flag && readableBytes < (headerLength)){//初始状态,且不能读取 协议头
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -181,7 +187,9 @@ public class MessageDecoder extends ByteToMessageDecoder {
|
|||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
logger.debug("decode end,type : "+businessType.getName()+" bodyLength: "+bodyLength+" , remain :" +remain);
|
if(Constants.DEBUG_MESSAGEDECODER_DECODE) {
|
||||||
|
logger.debug("decode end,type : "+businessType.getName()+" bodyLength: "+bodyLength+" , remain :" +remain);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user