交换机采集信息优化

This commit is contained in:
qiminbao
2025-09-22 23:41:25 +08:00
parent 95eafb0901
commit 30be98fde9
@@ -453,8 +453,7 @@ public class AgentServiceImpl implements AgentService {
} }
} }
break; break;
default: //系统其他采集 case "switchSysDescrCollect":
if(StringUtils.equals(type, "switchSysDescrCollect")){
if(GlobalConfig.switchSysDescrCollect != collect || GlobalConfig.switchSysDescrInterval != interval){ if(GlobalConfig.switchSysDescrCollect != collect || GlobalConfig.switchSysDescrInterval != interval){
flag = true; flag = true;
GlobalConfig.switchSysDescrCollect = collect; GlobalConfig.switchSysDescrCollect = collect;
@@ -463,8 +462,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchSysDescrInterval = 300; GlobalConfig.switchSysDescrInterval = 300;
} }
} }
} break;
if(StringUtils.equals(type, "switchSysObjectIDCollect")){ case "switchSysObjectIDCollect":
if(GlobalConfig.switchSysObjectIDCollect != collect || GlobalConfig.switchSysObjectIDInterval != interval){ if(GlobalConfig.switchSysObjectIDCollect != collect || GlobalConfig.switchSysObjectIDInterval != interval){
flag = true; flag = true;
GlobalConfig.switchSysObjectIDCollect = collect; GlobalConfig.switchSysObjectIDCollect = collect;
@@ -473,8 +472,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchSysObjectIDInterval = 300; GlobalConfig.switchSysObjectIDInterval = 300;
} }
} }
} break;
if(StringUtils.equals(type, "switchSysUpTimeCollect")){ case "switchSysUpTimeCollect":
if(GlobalConfig.switchSysUpTimeCollect != collect || GlobalConfig.switchSysUpTimeInterval != interval){ if(GlobalConfig.switchSysUpTimeCollect != collect || GlobalConfig.switchSysUpTimeInterval != interval){
flag = true; flag = true;
GlobalConfig.switchSysUpTimeCollect = collect; GlobalConfig.switchSysUpTimeCollect = collect;
@@ -483,8 +482,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchSysUpTimeInterval = 300; GlobalConfig.switchSysUpTimeInterval = 300;
} }
} }
} break;
if(StringUtils.equals(type, "switchSysContactCollect")){ case "switchSysContactCollect":
if(GlobalConfig.switchSysContactCollect != collect || GlobalConfig.switchSysContactInterval != interval){ if(GlobalConfig.switchSysContactCollect != collect || GlobalConfig.switchSysContactInterval != interval){
flag = true; flag = true;
GlobalConfig.switchSysContactCollect = collect; GlobalConfig.switchSysContactCollect = collect;
@@ -493,8 +492,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchSysContactInterval = 300; GlobalConfig.switchSysContactInterval = 300;
} }
} }
} break;
if(StringUtils.equals(type, "switchSysNameCollect")){ case "switchSysNameCollect":
if(GlobalConfig.switchSysNameCollect != collect || GlobalConfig.switchSysNameInterval != interval){ if(GlobalConfig.switchSysNameCollect != collect || GlobalConfig.switchSysNameInterval != interval){
flag = true; flag = true;
GlobalConfig.switchSysNameCollect = collect; GlobalConfig.switchSysNameCollect = collect;
@@ -503,8 +502,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchSysNameInterval = 300; GlobalConfig.switchSysNameInterval = 300;
} }
} }
} break;
if(StringUtils.equals(type, "switchSysLocationCollect")){ case "switchSysLocationCollect":
if(GlobalConfig.switchSysLocationCollect != collect || GlobalConfig.switchSysLocationInterval != interval){ if(GlobalConfig.switchSysLocationCollect != collect || GlobalConfig.switchSysLocationInterval != interval){
flag = true; flag = true;
GlobalConfig.switchSysLocationCollect = collect; GlobalConfig.switchSysLocationCollect = collect;
@@ -513,8 +512,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchSysLocationInterval = 300; GlobalConfig.switchSysLocationInterval = 300;
} }
} }
} break;
if(StringUtils.equals(type, "switchHwStackSystemMacCollect")){ case "switchHwStackSystemMacCollect":
if(GlobalConfig.switchHwStackSystemMacCollect != collect || GlobalConfig.switchHwStackSystemMacInterval != interval){ if(GlobalConfig.switchHwStackSystemMacCollect != collect || GlobalConfig.switchHwStackSystemMacInterval != interval){
flag = true; flag = true;
GlobalConfig.switchHwStackSystemMacCollect = collect; GlobalConfig.switchHwStackSystemMacCollect = collect;
@@ -523,8 +522,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchHwStackSystemMacInterval = 300; GlobalConfig.switchHwStackSystemMacInterval = 300;
} }
} }
} break;
if(StringUtils.equals(type, "switchEntIndexCollect")){ case "switchEntIndexCollect":
if(GlobalConfig.switchEntIndexCollect != collect || GlobalConfig.switchEntIndexInterval != interval){ if(GlobalConfig.switchEntIndexCollect != collect || GlobalConfig.switchEntIndexInterval != interval){
flag = true; flag = true;
GlobalConfig.switchEntIndexCollect = collect; GlobalConfig.switchEntIndexCollect = collect;
@@ -533,8 +532,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchEntIndexInterval = 300; GlobalConfig.switchEntIndexInterval = 300;
} }
} }
} break;
if(StringUtils.equals(type, "switchEntPhysicalNameCollect")){ case "switchEntPhysicalNameCollect":
if(GlobalConfig.switchEntPhysicalNameCollect != collect || GlobalConfig.switchEntPhysicalNameInterval != interval){ if(GlobalConfig.switchEntPhysicalNameCollect != collect || GlobalConfig.switchEntPhysicalNameInterval != interval){
flag = true; flag = true;
GlobalConfig.switchEntPhysicalNameCollect = collect; GlobalConfig.switchEntPhysicalNameCollect = collect;
@@ -543,8 +542,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchEntPhysicalNameInterval = 300; GlobalConfig.switchEntPhysicalNameInterval = 300;
} }
} }
} break;
if(StringUtils.equals(type, "switchEntPhysicalSoftwareRevCollect")){ case "switchEntPhysicalSoftwareRevCollect":
if(GlobalConfig.switchEntPhysicalSoftwareRevCollect != collect || GlobalConfig.switchEntPhysicalSoftwareRevInterval != interval){ if(GlobalConfig.switchEntPhysicalSoftwareRevCollect != collect || GlobalConfig.switchEntPhysicalSoftwareRevInterval != interval){
flag = true; flag = true;
GlobalConfig.switchEntPhysicalSoftwareRevCollect = collect; GlobalConfig.switchEntPhysicalSoftwareRevCollect = collect;
@@ -553,8 +552,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchEntPhysicalSoftwareRevInterval = 300; GlobalConfig.switchEntPhysicalSoftwareRevInterval = 300;
} }
} }
} break;
if(StringUtils.equals(type, "switchHwEntityCpuUsageCollect")){ case "switchHwEntityCpuUsageCollect":
if(GlobalConfig.switchHwEntityCpuUsageCollect != collect || GlobalConfig.switchHwEntityCpuUsageInterval != interval){ if(GlobalConfig.switchHwEntityCpuUsageCollect != collect || GlobalConfig.switchHwEntityCpuUsageInterval != interval){
flag = true; flag = true;
GlobalConfig.switchHwEntityCpuUsageCollect = collect; GlobalConfig.switchHwEntityCpuUsageCollect = collect;
@@ -563,8 +562,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchHwEntityCpuUsageInterval = 300; GlobalConfig.switchHwEntityCpuUsageInterval = 300;
} }
} }
} break;
if(StringUtils.equals(type, "switchHwEntityMemUsageCollect")){ case "switchHwEntityMemUsageCollect":
if(GlobalConfig.switchHwEntityMemUsageCollect != collect || GlobalConfig.switchHwEntityMemUsageInterval != interval){ if(GlobalConfig.switchHwEntityMemUsageCollect != collect || GlobalConfig.switchHwEntityMemUsageInterval != interval){
flag = true; flag = true;
GlobalConfig.switchHwEntityMemUsageCollect = collect; GlobalConfig.switchHwEntityMemUsageCollect = collect;
@@ -573,8 +572,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchHwEntityMemUsageInterval = 300; GlobalConfig.switchHwEntityMemUsageInterval = 300;
} }
} }
} break;
if(StringUtils.equals(type, "switchHwAveragePowerCollect")){ case "switchHwAveragePowerCollect":
if(GlobalConfig.switchHwAveragePowerCollect != collect || GlobalConfig.switchHwAveragePowerInterval != interval){ if(GlobalConfig.switchHwAveragePowerCollect != collect || GlobalConfig.switchHwAveragePowerInterval != interval){
flag = true; flag = true;
GlobalConfig.switchHwAveragePowerCollect = collect; GlobalConfig.switchHwAveragePowerCollect = collect;
@@ -583,8 +582,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchHwAveragePowerInterval = 300; GlobalConfig.switchHwAveragePowerInterval = 300;
} }
} }
} break;
if(StringUtils.equals(type, "switchHwCurrentPowerCollect")){ default: //系统其他采集
if(GlobalConfig.switchHwCurrentPowerCollect != collect || GlobalConfig.switchHwCurrentPowerInterval != interval){ if(GlobalConfig.switchHwCurrentPowerCollect != collect || GlobalConfig.switchHwCurrentPowerInterval != interval){
flag = true; flag = true;
GlobalConfig.switchHwCurrentPowerCollect = collect; GlobalConfig.switchHwCurrentPowerCollect = collect;
@@ -594,12 +593,11 @@ public class AgentServiceImpl implements AgentService {
} }
} }
} }
}
if (flag) { if (flag) {
if(collect){ if(collect){
long milli = AgentUtil.millisecondsToNext5Minute(); long milli = AgentUtil.millisecondsToNext5Minute();
dynamicTaskService.scheduleTask(c.getType(), dynamicTaskService.scheduleTask(type,
() -> businessTasks.switchBoardTask(c.getType()), milli, interval*1000L); () -> businessTasks.switchBoardTask(type), milli, interval*1000L);
}else{ }else{
dynamicTaskService.cancelTask(type); dynamicTaskService.cancelTask(type);
} }