|
|
|
@@ -24,10 +24,10 @@ public class AgentEndpoint {
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.登录认证)
|
|
|
|
|
public class LoginHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public UpMsgResponse upHandle(String data) {
|
|
|
|
|
public UpMsgResponse upHandle(String data, String clientId) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
String clientId = jsonObject.getString("clientId");
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(data).build();
|
|
|
|
|
jsonObject.put("dataType",MsgEnum.登录认证.getValue());
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(jsonObject.toString()).build();
|
|
|
|
|
agentProducer.asyncSend(mqMsg);
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
json.put("resCode",1);
|
|
|
|
@@ -59,10 +59,10 @@ public class AgentEndpoint {
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.心跳包)
|
|
|
|
|
public class HeartBeatHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public UpMsgResponse upHandle(String data) {
|
|
|
|
|
public UpMsgResponse upHandle(String data, String clientId) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
String clientId = jsonObject.getString("clientId");
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(data).build();
|
|
|
|
|
jsonObject.put("dataType",MsgEnum.心跳包.getValue());
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(jsonObject.toString()).build();
|
|
|
|
|
agentProducer.asyncSend(mqMsg);
|
|
|
|
|
|
|
|
|
|
// T0x04 obj = new T0x04();
|
|
|
|
@@ -111,10 +111,10 @@ public class AgentEndpoint {
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.CPU包)
|
|
|
|
|
public class CpuHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public UpMsgResponse upHandle(String data) {
|
|
|
|
|
public UpMsgResponse upHandle(String data, String clientId) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
String clientId = jsonObject.getString("clientId");
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(data).build();
|
|
|
|
|
jsonObject.put("dataType",MsgEnum.CPU包.getValue());
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(jsonObject.toString()).build();
|
|
|
|
|
agentProducer.asyncSend(mqMsg);
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
json.put("resCode",1);
|
|
|
|
@@ -135,10 +135,10 @@ public class AgentEndpoint {
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.磁盘包)
|
|
|
|
|
public class DiskHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public UpMsgResponse upHandle(String data) {
|
|
|
|
|
public UpMsgResponse upHandle(String data, String clientId) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
String clientId = jsonObject.getString("clientId");
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(data).build();
|
|
|
|
|
jsonObject.put("dataType",MsgEnum.CPU包.getValue());
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(jsonObject.toString()).build();
|
|
|
|
|
agentProducer.asyncSend(mqMsg);
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
json.put("resCode",1);
|
|
|
|
@@ -159,10 +159,10 @@ public class AgentEndpoint {
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.内存包)
|
|
|
|
|
public class MemoryHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public UpMsgResponse upHandle(String data) {
|
|
|
|
|
public UpMsgResponse upHandle(String data, String clientId) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
String clientId = jsonObject.getString("clientId");
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(data).build();
|
|
|
|
|
jsonObject.put("dataType",MsgEnum.内存包.getValue());
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(jsonObject.toString()).build();
|
|
|
|
|
agentProducer.asyncSend(mqMsg);
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
json.put("resCode",1);
|
|
|
|
@@ -183,10 +183,10 @@ public class AgentEndpoint {
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.网卡包)
|
|
|
|
|
public class NetHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public UpMsgResponse upHandle(String data) {
|
|
|
|
|
public UpMsgResponse upHandle(String data, String clientId) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
String clientId = jsonObject.getString("clientId");
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(data).build();
|
|
|
|
|
jsonObject.put("dataType",MsgEnum.网卡包.getValue());
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(jsonObject.toString()).build();
|
|
|
|
|
agentProducer.asyncSend(mqMsg);
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
json.put("resCode",1);
|
|
|
|
@@ -207,10 +207,10 @@ public class AgentEndpoint {
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.挂载点包)
|
|
|
|
|
public class PointHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public UpMsgResponse upHandle(String data) {
|
|
|
|
|
public UpMsgResponse upHandle(String data, String clientId) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
String clientId = jsonObject.getString("clientId");
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(data).build();
|
|
|
|
|
jsonObject.put("dataType",MsgEnum.挂载点包.getValue());
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(jsonObject.toString()).build();
|
|
|
|
|
agentProducer.asyncSend(mqMsg);
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
json.put("resCode",1);
|
|
|
|
@@ -231,10 +231,10 @@ public class AgentEndpoint {
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.系统包)
|
|
|
|
|
public class SystemHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public UpMsgResponse upHandle(String data) {
|
|
|
|
|
public UpMsgResponse upHandle(String data, String clientId) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
String clientId = jsonObject.getString("clientId");
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(data).build();
|
|
|
|
|
jsonObject.put("dataType",MsgEnum.系统包.getValue());
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(jsonObject.toString()).build();
|
|
|
|
|
agentProducer.asyncSend(mqMsg);
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
json.put("resCode",1);
|
|
|
|
@@ -255,10 +255,10 @@ public class AgentEndpoint {
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.交换机包)
|
|
|
|
|
public class SwitchBoardHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public UpMsgResponse upHandle(String data) {
|
|
|
|
|
public UpMsgResponse upHandle(String data, String clientId) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
String clientId = jsonObject.getString("clientId");
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(data).build();
|
|
|
|
|
jsonObject.put("dataType",MsgEnum.交换机包.getValue());
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(jsonObject.toString()).build();
|
|
|
|
|
agentProducer.asyncSend(mqMsg);
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
json.put("resCode",1);
|
|
|
|
@@ -276,7 +276,197 @@ public class AgentEndpoint {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.更新CPU采集间隔)
|
|
|
|
|
public class TimeCpuHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public String downHandle(String data) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
long intervalMillis = jsonObject.getLong("intervalMillis");
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
json.put("intervalMillis",intervalMillis);
|
|
|
|
|
return json.toString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.更新CPU采集间隔应答)
|
|
|
|
|
public class TimeCpuRspHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public UpMsgResponse upHandle(String data, String clientId) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
jsonObject.put("dataType",MsgEnum.更新CPU采集间隔应答.getValue());
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(jsonObject.toString()).build();
|
|
|
|
|
agentProducer.asyncSend(mqMsg);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.更新容器采集间隔)
|
|
|
|
|
public class TimeDockerHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public String downHandle(String data) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
long intervalMillis = jsonObject.getLong("intervalMillis");
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
json.put("intervalMillis",intervalMillis);
|
|
|
|
|
return json.toString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.更新容器采集间隔应答)
|
|
|
|
|
public class TimeDockerRspHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public UpMsgResponse upHandle(String data, String clientId) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
jsonObject.put("dataType",MsgEnum.更新容器采集间隔应答.getValue());
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(jsonObject.toString()).build();
|
|
|
|
|
agentProducer.asyncSend(mqMsg);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.更新网卡采集间隔)
|
|
|
|
|
public class TimeNetHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public String downHandle(String data) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
long intervalMillis = jsonObject.getLong("intervalMillis");
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
json.put("intervalMillis",intervalMillis);
|
|
|
|
|
return json.toString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.更新网卡采集间隔应答)
|
|
|
|
|
public class TimeNetRspHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public UpMsgResponse upHandle(String data, String clientId) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
jsonObject.put("dataType",MsgEnum.更新网卡采集间隔应答.getValue());
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(jsonObject.toString()).build();
|
|
|
|
|
agentProducer.asyncSend(mqMsg);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.更新交换机采集间隔)
|
|
|
|
|
public class TimeSwitchHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public String downHandle(String data) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
long intervalMillis = jsonObject.getLong("intervalMillis");
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
json.put("intervalMillis",intervalMillis);
|
|
|
|
|
return json.toString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.更新交换机采集间隔应答)
|
|
|
|
|
public class TimeSwitchRspHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public UpMsgResponse upHandle(String data, String clientId) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
jsonObject.put("dataType",MsgEnum.更新交换机采集间隔应答.getValue());
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(jsonObject.toString()).build();
|
|
|
|
|
agentProducer.asyncSend(mqMsg);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.更新磁盘采集间隔)
|
|
|
|
|
public class TimeDiskHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public String downHandle(String data) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
long intervalMillis = jsonObject.getLong("intervalMillis");
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
json.put("intervalMillis",intervalMillis);
|
|
|
|
|
return json.toString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.更新磁盘采集间隔应答)
|
|
|
|
|
public class TimeDiskRspHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public UpMsgResponse upHandle(String data, String clientId) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
jsonObject.put("dataType",MsgEnum.更新磁盘采集间隔应答.getValue());
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(jsonObject.toString()).build();
|
|
|
|
|
agentProducer.asyncSend(mqMsg);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.更新挂载采集间隔)
|
|
|
|
|
public class TimePointHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public String downHandle(String data) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
long intervalMillis = jsonObject.getLong("intervalMillis");
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
json.put("intervalMillis",intervalMillis);
|
|
|
|
|
return json.toString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.更新挂载采集间隔应答)
|
|
|
|
|
public class TimePointRspHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public UpMsgResponse upHandle(String data, String clientId) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
jsonObject.put("dataType",MsgEnum.更新挂载采集间隔应答.getValue());
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(jsonObject.toString()).build();
|
|
|
|
|
agentProducer.asyncSend(mqMsg);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.更新内存采集间隔)
|
|
|
|
|
public class TimeMemoryHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public String downHandle(String data) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
long intervalMillis = jsonObject.getLong("intervalMillis");
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
json.put("intervalMillis",intervalMillis);
|
|
|
|
|
return json.toString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.更新内存采集间隔应答)
|
|
|
|
|
public class TimeMemoryRspHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public UpMsgResponse upHandle(String data, String clientId) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
jsonObject.put("dataType",MsgEnum.更新内存采集间隔应答.getValue());
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(jsonObject.toString()).build();
|
|
|
|
|
agentProducer.asyncSend(mqMsg);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.更新系统采集间隔)
|
|
|
|
|
public class TimeSystemHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public String downHandle(String data) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
long intervalMillis = jsonObject.getLong("intervalMillis");
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
json.put("intervalMillis",intervalMillis);
|
|
|
|
|
return json.toString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AgentDispatcher(msgId = MsgEnum.更新系统采集间隔应答)
|
|
|
|
|
public class TimeSystemRspHandler implements AgentMsgHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public UpMsgResponse upHandle(String data, String clientId) {
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
jsonObject.put("dataType",MsgEnum.更新系统采集间隔应答.getValue());
|
|
|
|
|
MqMsg mqMsg = MqMsg.builder().topic(agentMqConfig.getAgentTopic()).content(jsonObject.toString()).build();
|
|
|
|
|
agentProducer.asyncSend(mqMsg);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|