交换机采集信息优化
This commit is contained in:
@@ -453,153 +453,151 @@ public class AgentServiceImpl implements AgentService {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "switchSysDescrCollect":
|
||||
if(GlobalConfig.switchSysDescrCollect != collect || GlobalConfig.switchSysDescrInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchSysDescrCollect = collect;
|
||||
GlobalConfig.switchSysDescrInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchSysDescrInterval = 300;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "switchSysObjectIDCollect":
|
||||
if(GlobalConfig.switchSysObjectIDCollect != collect || GlobalConfig.switchSysObjectIDInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchSysObjectIDCollect = collect;
|
||||
GlobalConfig.switchSysObjectIDInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchSysObjectIDInterval = 300;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "switchSysUpTimeCollect":
|
||||
if(GlobalConfig.switchSysUpTimeCollect != collect || GlobalConfig.switchSysUpTimeInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchSysUpTimeCollect = collect;
|
||||
GlobalConfig.switchSysUpTimeInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchSysUpTimeInterval = 300;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "switchSysContactCollect":
|
||||
if(GlobalConfig.switchSysContactCollect != collect || GlobalConfig.switchSysContactInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchSysContactCollect = collect;
|
||||
GlobalConfig.switchSysContactInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchSysContactInterval = 300;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "switchSysNameCollect":
|
||||
if(GlobalConfig.switchSysNameCollect != collect || GlobalConfig.switchSysNameInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchSysNameCollect = collect;
|
||||
GlobalConfig.switchSysNameInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchSysNameInterval = 300;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "switchSysLocationCollect":
|
||||
if(GlobalConfig.switchSysLocationCollect != collect || GlobalConfig.switchSysLocationInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchSysLocationCollect = collect;
|
||||
GlobalConfig.switchSysLocationInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchSysLocationInterval = 300;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "switchHwStackSystemMacCollect":
|
||||
if(GlobalConfig.switchHwStackSystemMacCollect != collect || GlobalConfig.switchHwStackSystemMacInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchHwStackSystemMacCollect = collect;
|
||||
GlobalConfig.switchHwStackSystemMacInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchHwStackSystemMacInterval = 300;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "switchEntIndexCollect":
|
||||
if(GlobalConfig.switchEntIndexCollect != collect || GlobalConfig.switchEntIndexInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchEntIndexCollect = collect;
|
||||
GlobalConfig.switchEntIndexInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchEntIndexInterval = 300;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "switchEntPhysicalNameCollect":
|
||||
if(GlobalConfig.switchEntPhysicalNameCollect != collect || GlobalConfig.switchEntPhysicalNameInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchEntPhysicalNameCollect = collect;
|
||||
GlobalConfig.switchEntPhysicalNameInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchEntPhysicalNameInterval = 300;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "switchEntPhysicalSoftwareRevCollect":
|
||||
if(GlobalConfig.switchEntPhysicalSoftwareRevCollect != collect || GlobalConfig.switchEntPhysicalSoftwareRevInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchEntPhysicalSoftwareRevCollect = collect;
|
||||
GlobalConfig.switchEntPhysicalSoftwareRevInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchEntPhysicalSoftwareRevInterval = 300;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "switchHwEntityCpuUsageCollect":
|
||||
if(GlobalConfig.switchHwEntityCpuUsageCollect != collect || GlobalConfig.switchHwEntityCpuUsageInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchHwEntityCpuUsageCollect = collect;
|
||||
GlobalConfig.switchHwEntityCpuUsageInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchHwEntityCpuUsageInterval = 300;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "switchHwEntityMemUsageCollect":
|
||||
if(GlobalConfig.switchHwEntityMemUsageCollect != collect || GlobalConfig.switchHwEntityMemUsageInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchHwEntityMemUsageCollect = collect;
|
||||
GlobalConfig.switchHwEntityMemUsageInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchHwEntityMemUsageInterval = 300;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "switchHwAveragePowerCollect":
|
||||
if(GlobalConfig.switchHwAveragePowerCollect != collect || GlobalConfig.switchHwAveragePowerInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchHwAveragePowerCollect = collect;
|
||||
GlobalConfig.switchHwAveragePowerInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchHwAveragePowerInterval = 300;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default: //系统其他采集
|
||||
if(StringUtils.equals(type, "switchSysDescrCollect")){
|
||||
if(GlobalConfig.switchSysDescrCollect != collect || GlobalConfig.switchSysDescrInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchSysDescrCollect = collect;
|
||||
GlobalConfig.switchSysDescrInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchSysDescrInterval = 300;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.equals(type, "switchSysObjectIDCollect")){
|
||||
if(GlobalConfig.switchSysObjectIDCollect != collect || GlobalConfig.switchSysObjectIDInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchSysObjectIDCollect = collect;
|
||||
GlobalConfig.switchSysObjectIDInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchSysObjectIDInterval = 300;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.equals(type, "switchSysUpTimeCollect")){
|
||||
if(GlobalConfig.switchSysUpTimeCollect != collect || GlobalConfig.switchSysUpTimeInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchSysUpTimeCollect = collect;
|
||||
GlobalConfig.switchSysUpTimeInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchSysUpTimeInterval = 300;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.equals(type, "switchSysContactCollect")){
|
||||
if(GlobalConfig.switchSysContactCollect != collect || GlobalConfig.switchSysContactInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchSysContactCollect = collect;
|
||||
GlobalConfig.switchSysContactInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchSysContactInterval = 300;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.equals(type, "switchSysNameCollect")){
|
||||
if(GlobalConfig.switchSysNameCollect != collect || GlobalConfig.switchSysNameInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchSysNameCollect = collect;
|
||||
GlobalConfig.switchSysNameInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchSysNameInterval = 300;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.equals(type, "switchSysLocationCollect")){
|
||||
if(GlobalConfig.switchSysLocationCollect != collect || GlobalConfig.switchSysLocationInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchSysLocationCollect = collect;
|
||||
GlobalConfig.switchSysLocationInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchSysLocationInterval = 300;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.equals(type, "switchHwStackSystemMacCollect")){
|
||||
if(GlobalConfig.switchHwStackSystemMacCollect != collect || GlobalConfig.switchHwStackSystemMacInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchHwStackSystemMacCollect = collect;
|
||||
GlobalConfig.switchHwStackSystemMacInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchHwStackSystemMacInterval = 300;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.equals(type, "switchEntIndexCollect")){
|
||||
if(GlobalConfig.switchEntIndexCollect != collect || GlobalConfig.switchEntIndexInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchEntIndexCollect = collect;
|
||||
GlobalConfig.switchEntIndexInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchEntIndexInterval = 300;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.equals(type, "switchEntPhysicalNameCollect")){
|
||||
if(GlobalConfig.switchEntPhysicalNameCollect != collect || GlobalConfig.switchEntPhysicalNameInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchEntPhysicalNameCollect = collect;
|
||||
GlobalConfig.switchEntPhysicalNameInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchEntPhysicalNameInterval = 300;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.equals(type, "switchEntPhysicalSoftwareRevCollect")){
|
||||
if(GlobalConfig.switchEntPhysicalSoftwareRevCollect != collect || GlobalConfig.switchEntPhysicalSoftwareRevInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchEntPhysicalSoftwareRevCollect = collect;
|
||||
GlobalConfig.switchEntPhysicalSoftwareRevInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchEntPhysicalSoftwareRevInterval = 300;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.equals(type, "switchHwEntityCpuUsageCollect")){
|
||||
if(GlobalConfig.switchHwEntityCpuUsageCollect != collect || GlobalConfig.switchHwEntityCpuUsageInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchHwEntityCpuUsageCollect = collect;
|
||||
GlobalConfig.switchHwEntityCpuUsageInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchHwEntityCpuUsageInterval = 300;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.equals(type, "switchHwEntityMemUsageCollect")){
|
||||
if(GlobalConfig.switchHwEntityMemUsageCollect != collect || GlobalConfig.switchHwEntityMemUsageInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchHwEntityMemUsageCollect = collect;
|
||||
GlobalConfig.switchHwEntityMemUsageInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchHwEntityMemUsageInterval = 300;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.equals(type, "switchHwAveragePowerCollect")){
|
||||
if(GlobalConfig.switchHwAveragePowerCollect != collect || GlobalConfig.switchHwAveragePowerInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchHwAveragePowerCollect = collect;
|
||||
GlobalConfig.switchHwAveragePowerInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchHwAveragePowerInterval = 300;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.equals(type, "switchHwCurrentPowerCollect")){
|
||||
if(GlobalConfig.switchHwCurrentPowerCollect != collect || GlobalConfig.switchHwCurrentPowerInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchHwCurrentPowerCollect = collect;
|
||||
GlobalConfig.switchHwCurrentPowerInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchHwCurrentPowerInterval = 300;
|
||||
}
|
||||
if(GlobalConfig.switchHwCurrentPowerCollect != collect || GlobalConfig.switchHwCurrentPowerInterval != interval){
|
||||
flag = true;
|
||||
GlobalConfig.switchHwCurrentPowerCollect = collect;
|
||||
GlobalConfig.switchHwCurrentPowerInterval = interval;
|
||||
if(!collect){
|
||||
GlobalConfig.switchHwCurrentPowerInterval = 300;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
if(collect){
|
||||
long milli = AgentUtil.millisecondsToNext5Minute();
|
||||
dynamicTaskService.scheduleTask(c.getType(),
|
||||
() -> businessTasks.switchBoardTask(c.getType()), milli, interval*1000L);
|
||||
dynamicTaskService.scheduleTask(type,
|
||||
() -> businessTasks.switchBoardTask(type), milli, interval*1000L);
|
||||
}else{
|
||||
dynamicTaskService.cancelTask(type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user