采集业务细节优化

This commit is contained in:
qiminbao
2025-09-12 14:34:43 +08:00
parent 2c29156748
commit 71ad483c26
11 changed files with 451 additions and 169 deletions
@@ -119,11 +119,7 @@ public class AgentEndpoint {
//更改全局变量
GlobalConfig.isCollect = false;
//调用采集任务
try {
appInitializer.run();
} catch (Exception e) {
e.printStackTrace();
}
agentService.cancelCollect();
long timestamp = System.currentTimeMillis();
timestamp = Math.round(timestamp / 1000.0);
JSONObject json = new JSONObject();
@@ -135,7 +131,7 @@ public class AgentEndpoint {
}
}
@AgentDispatcher(msgId = MsgEnum.开启系统采集)
@AgentDispatcher(msgId = MsgEnum.开启或更新系统采集)
public class SysCollectStartHandler implements AgentHandler {
@Override
public UpMsgResponse upHandle(String data, String clientId) {
@@ -147,11 +143,11 @@ public class AgentEndpoint {
json.put("resCode",1);
json.put("resMag","");
json.put("timestamp",timestamp);
return UpMsgResponse.builder().dataType(MsgEnum.开启系统采集应答.getValue()).content(json.toString()).build();
return UpMsgResponse.builder().dataType(MsgEnum.开启或更新系统采集应答.getValue()).content(json.toString()).build();
}
}
@AgentDispatcher(msgId = MsgEnum.关闭系统采集)
@AgentDispatcher(msgId = MsgEnum.关闭所有系统采集)
public class SysCollectStopHandler implements AgentHandler {
@Override
public UpMsgResponse upHandle(String data, String clientId) {
@@ -163,11 +159,11 @@ public class AgentEndpoint {
json.put("resCode",1);
json.put("resMag","");
json.put("timestamp",timestamp);
return UpMsgResponse.builder().dataType(MsgEnum.关闭系统采集应答.getValue()).content(json.toString()).build();
return UpMsgResponse.builder().dataType(MsgEnum.关闭所有系统采集应答.getValue()).content(json.toString()).build();
}
}
@AgentDispatcher(msgId = MsgEnum.开启交换机采集)
@AgentDispatcher(msgId = MsgEnum.开启或更新交换机采集)
public class SwitchCollectStartHandler implements AgentHandler {
@Override
public UpMsgResponse upHandle(String data, String clientId) {
@@ -179,11 +175,11 @@ public class AgentEndpoint {
json.put("resCode",1);
json.put("resMag","");
json.put("timestamp",timestamp);
return UpMsgResponse.builder().dataType(MsgEnum.开启交换机采集应答.getValue()).content(json.toString()).build();
return UpMsgResponse.builder().dataType(MsgEnum.开启或更新交换机采集应答.getValue()).content(json.toString()).build();
}
}
@AgentDispatcher(msgId = MsgEnum.关闭交换机采集)
@AgentDispatcher(msgId = MsgEnum.关闭所有交换机采集)
public class SwitchCollectStopHandler implements AgentHandler {
@Override
public UpMsgResponse upHandle(String data, String clientId) {
@@ -195,7 +191,7 @@ public class AgentEndpoint {
json.put("resCode",1);
json.put("resMag","");
json.put("timestamp",timestamp);
return UpMsgResponse.builder().dataType(MsgEnum.关闭交换机采集应答.getValue()).content(json.toString()).build();
return UpMsgResponse.builder().dataType(MsgEnum.关闭所有交换机采集应答.getValue()).content(json.toString()).build();
}
}