交换机采集信息优化

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;
default: //系统其他采集
if(StringUtils.equals(type, "switchSysDescrCollect")){
case "switchSysDescrCollect":
if(GlobalConfig.switchSysDescrCollect != collect || GlobalConfig.switchSysDescrInterval != interval){
flag = true;
GlobalConfig.switchSysDescrCollect = collect;
@@ -463,8 +462,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchSysDescrInterval = 300;
}
}
}
if(StringUtils.equals(type, "switchSysObjectIDCollect")){
break;
case "switchSysObjectIDCollect":
if(GlobalConfig.switchSysObjectIDCollect != collect || GlobalConfig.switchSysObjectIDInterval != interval){
flag = true;
GlobalConfig.switchSysObjectIDCollect = collect;
@@ -473,8 +472,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchSysObjectIDInterval = 300;
}
}
}
if(StringUtils.equals(type, "switchSysUpTimeCollect")){
break;
case "switchSysUpTimeCollect":
if(GlobalConfig.switchSysUpTimeCollect != collect || GlobalConfig.switchSysUpTimeInterval != interval){
flag = true;
GlobalConfig.switchSysUpTimeCollect = collect;
@@ -483,8 +482,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchSysUpTimeInterval = 300;
}
}
}
if(StringUtils.equals(type, "switchSysContactCollect")){
break;
case "switchSysContactCollect":
if(GlobalConfig.switchSysContactCollect != collect || GlobalConfig.switchSysContactInterval != interval){
flag = true;
GlobalConfig.switchSysContactCollect = collect;
@@ -493,8 +492,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchSysContactInterval = 300;
}
}
}
if(StringUtils.equals(type, "switchSysNameCollect")){
break;
case "switchSysNameCollect":
if(GlobalConfig.switchSysNameCollect != collect || GlobalConfig.switchSysNameInterval != interval){
flag = true;
GlobalConfig.switchSysNameCollect = collect;
@@ -503,8 +502,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchSysNameInterval = 300;
}
}
}
if(StringUtils.equals(type, "switchSysLocationCollect")){
break;
case "switchSysLocationCollect":
if(GlobalConfig.switchSysLocationCollect != collect || GlobalConfig.switchSysLocationInterval != interval){
flag = true;
GlobalConfig.switchSysLocationCollect = collect;
@@ -513,8 +512,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchSysLocationInterval = 300;
}
}
}
if(StringUtils.equals(type, "switchHwStackSystemMacCollect")){
break;
case "switchHwStackSystemMacCollect":
if(GlobalConfig.switchHwStackSystemMacCollect != collect || GlobalConfig.switchHwStackSystemMacInterval != interval){
flag = true;
GlobalConfig.switchHwStackSystemMacCollect = collect;
@@ -523,8 +522,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchHwStackSystemMacInterval = 300;
}
}
}
if(StringUtils.equals(type, "switchEntIndexCollect")){
break;
case "switchEntIndexCollect":
if(GlobalConfig.switchEntIndexCollect != collect || GlobalConfig.switchEntIndexInterval != interval){
flag = true;
GlobalConfig.switchEntIndexCollect = collect;
@@ -533,8 +532,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchEntIndexInterval = 300;
}
}
}
if(StringUtils.equals(type, "switchEntPhysicalNameCollect")){
break;
case "switchEntPhysicalNameCollect":
if(GlobalConfig.switchEntPhysicalNameCollect != collect || GlobalConfig.switchEntPhysicalNameInterval != interval){
flag = true;
GlobalConfig.switchEntPhysicalNameCollect = collect;
@@ -543,8 +542,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchEntPhysicalNameInterval = 300;
}
}
}
if(StringUtils.equals(type, "switchEntPhysicalSoftwareRevCollect")){
break;
case "switchEntPhysicalSoftwareRevCollect":
if(GlobalConfig.switchEntPhysicalSoftwareRevCollect != collect || GlobalConfig.switchEntPhysicalSoftwareRevInterval != interval){
flag = true;
GlobalConfig.switchEntPhysicalSoftwareRevCollect = collect;
@@ -553,8 +552,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchEntPhysicalSoftwareRevInterval = 300;
}
}
}
if(StringUtils.equals(type, "switchHwEntityCpuUsageCollect")){
break;
case "switchHwEntityCpuUsageCollect":
if(GlobalConfig.switchHwEntityCpuUsageCollect != collect || GlobalConfig.switchHwEntityCpuUsageInterval != interval){
flag = true;
GlobalConfig.switchHwEntityCpuUsageCollect = collect;
@@ -563,8 +562,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchHwEntityCpuUsageInterval = 300;
}
}
}
if(StringUtils.equals(type, "switchHwEntityMemUsageCollect")){
break;
case "switchHwEntityMemUsageCollect":
if(GlobalConfig.switchHwEntityMemUsageCollect != collect || GlobalConfig.switchHwEntityMemUsageInterval != interval){
flag = true;
GlobalConfig.switchHwEntityMemUsageCollect = collect;
@@ -573,8 +572,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchHwEntityMemUsageInterval = 300;
}
}
}
if(StringUtils.equals(type, "switchHwAveragePowerCollect")){
break;
case "switchHwAveragePowerCollect":
if(GlobalConfig.switchHwAveragePowerCollect != collect || GlobalConfig.switchHwAveragePowerInterval != interval){
flag = true;
GlobalConfig.switchHwAveragePowerCollect = collect;
@@ -583,8 +582,8 @@ public class AgentServiceImpl implements AgentService {
GlobalConfig.switchHwAveragePowerInterval = 300;
}
}
}
if(StringUtils.equals(type, "switchHwCurrentPowerCollect")){
break;
default: //系统其他采集
if(GlobalConfig.switchHwCurrentPowerCollect != collect || GlobalConfig.switchHwCurrentPowerInterval != interval){
flag = true;
GlobalConfig.switchHwCurrentPowerCollect = collect;
@@ -594,12 +593,11 @@ public class AgentServiceImpl implements AgentService {
}
}
}
}
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);
}