Commit 46c72c5e authored by gaozhentao's avatar gaozhentao

微信告警修改完成

parent 93b70999
......@@ -21,6 +21,9 @@ public class InitAscynTaskThreadPoolConfig {
@Value("${ascynTaskThreadPool.maxPoolSize}")
private int MAX_POOL_SIZE;
@Value("${ascynTaskThreadPool.queueCapacity}")
private int QUEUE_CAPACITY;
@Bean(name = "asyncTaskPool")
public AsyncTaskExecutor taskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
......@@ -35,14 +38,17 @@ public class InitAscynTaskThreadPoolConfig {
logger.info("异步任务线程池最大线程数: {}", MAX_POOL_SIZE);
executor.setCorePoolSize(CORE_POOL_SIZE);
executor.setMaxPoolSize(MAX_POOL_SIZE);
executor.setQueueCapacity(QUEUE_CAPACITY);
return executor;
}
@Bean(name = "monitorLink" )
public Executor getLinkState() {
public Executor monitorTask() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(CORE_POOL_SIZE);
executor.setMaxPoolSize(MAX_POOL_SIZE);
executor.setQueueCapacity(QUEUE_CAPACITY);
executor.initialize();
return executor;
}
......
......@@ -131,24 +131,22 @@ public class AlarmTask {
if(flag){
if(alarmCheck != null){
/* 如果存在告警 则恢复 */
System.out.println("告警恢复了?");
cassandraDao.updateAlarm(alarmCheck.getSerialnum(),TimeUtil.getDate());
String recoveryMsg = alarmCheck.getClusterName() + " " + alarmCheck.getIp()
+ ":" + alarmCheck.getPort() + ",告警已恢复";
monitorConfig.setAlarmMsg("【告警恢复】"+recoveryMsg);
if(TokenInterceptor.currSwitch){
//MonitorUtil.wxAlarm(monitorConfig);
MonitorUtil.wxAlarm(monitorConfig);
}
}
}else{
if(alarmCheck == null){
/* 如果不存在告警 新增数据 */
cassandraDao.insertAlarm(alarmLog);
System.out.println("kk:"+(++kk));
monitorConfig.setAlarmMsg(alarmLog.getAlarmMessage());
if(TokenInterceptor.currSwitch){
//MonitorUtil.wxAlarm(monitorConfig);
MonitorUtil.wxAlarm(monitorConfig);
}
}else {
/* 如果告警发生变化 回复时间变成告警时间 */
......@@ -157,7 +155,7 @@ public class AlarmTask {
cassandraDao.insertAlarm(alarmLog);
monitorConfig.setAlarmMsg("【告警内容更新】"+alarmLog.getAlarmMessage());
if(TokenInterceptor.currSwitch){
//MonitorUtil.wxAlarm(monitorConfig);
MonitorUtil.wxAlarm(monitorConfig);
}
}
}
......@@ -166,8 +164,6 @@ public class AlarmTask {
logger.error("告警校验发生错误。inMonitoring返回false");
logger.error(e.getMessage());
}
long end = System.currentTimeMillis()-begin;
}
private QueryBuilder createQuery(int start, TimeUnit timeUnit, String metric, String tag, Aggregator aggregator) {
......
......@@ -40,9 +40,10 @@ demo:
dailyAuthCount:
url: "http://15.1.3.8:9000/acl/v1/dailyCount"
ascynTaskThreadPool:
corePoolSize: 60
maxPoolSize: 80
corePoolSize: 100
maxPoolSize: 200
clusterStatusPoolSize: 16
queueCapacity: 100
alarm:
ip: "15.2.249.205"
port: 8899
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment