增加TCP数据头

This commit is contained in:
qiminbao
2025-08-25 12:08:52 +08:00
parent d5fca554f1
commit 44f812e243
10 changed files with 15 additions and 15 deletions
@@ -56,7 +56,7 @@ public class CpuScheduler {
String clientId = AgentUtil.getMotherboardUUID();
Message message = Message.builder().clientId(clientId).dataType("CPU").data(data).build();
// 将对象转为 JSON 字符串
String json = "agent-tcp:"+JSON.toJSONString(message)+"@tong-ran";
String json = JSON.toJSONString(message);
AssertLog.info("发送CPU信息包={}",json);
nettyTcpClient.sendMessage(json);
}
@@ -59,7 +59,7 @@ public class DiskScheduler {
String clientId = AgentUtil.getMotherboardUUID();
Message message = Message.builder().clientId(clientId).dataType("DISK").data(data).build();
// 将对象转为 JSON 字符串
String json = "agent-tcp:"+JSON.toJSONString(message)+"@tong-ran";
String json = JSON.toJSONString(message);
AssertLog.info("发送磁盘信息包={}",json);
nettyTcpClient.sendMessage(json);
}
@@ -59,7 +59,7 @@ public class DockerScheduler {
String clientId = AgentUtil.getMotherboardUUID();
Message message = Message.builder().clientId(clientId).dataType("DOCKER").data(data).build();
// 将对象转为 JSON 字符串
String json = "agent-tcp:"+JSON.toJSONString(message)+"@tong-ran";
String json = JSON.toJSONString(message);
AssertLog.info("发送容器信息包={}",json);
nettyTcpClient.sendMessage(json);
}
@@ -58,7 +58,7 @@ public class HeartScheduler {
String clientId = AgentUtil.getMotherboardUUID();
Message message = Message.builder().clientId(clientId).dataType("HEARTBEAT").data(object.toString()).build();
// 将对象转为 JSON 字符串 标识
String json = "agent-tcp:"+JSON.toJSONString(message)+"@tong-ran";
String json = JSON.toJSONString(message);
AssertLog.info("发送心跳包={}",json);
nettyTcpClient.sendMessage(json);
};
@@ -57,7 +57,7 @@ public class MemoryScheduler {
String clientId = AgentUtil.getMotherboardUUID();
Message message = Message.builder().clientId(clientId).dataType("MEMORY").data(data).build();
// 将对象转为 JSON 字符串
String json = "agent-tcp:"+JSON.toJSONString(message)+"@tong-ran";
String json = JSON.toJSONString(message);
AssertLog.info("发送内存信息包={}",json);
nettyTcpClient.sendMessage(json);
}
@@ -59,7 +59,7 @@ public class NetScheduler {
String clientId = AgentUtil.getMotherboardUUID();
Message message = Message.builder().clientId(clientId).dataType("NET").data(data).build();
// 将对象转为 JSON 字符串
String json = "agent-tcp:"+JSON.toJSONString(message)+"@tong-ran";
String json = JSON.toJSONString(message);
AssertLog.info("发送网卡信息包={}",json);
nettyTcpClient.sendMessage(json);
}
@@ -59,7 +59,7 @@ public class PointScheduler {
String clientId = AgentUtil.getMotherboardUUID();
Message message = Message.builder().clientId(clientId).dataType("POINT").data(data).build();
// 将对象转为 JSON 字符串
String json = "agent-tcp:"+JSON.toJSONString(message)+"@tong-ran";
String json = JSON.toJSONString(message);
AssertLog.info("发送挂载点信息包={}",json);
nettyTcpClient.sendMessage(json);
}
@@ -34,9 +34,9 @@ public class SwitchBoardScheduler {
@PostConstruct
public void init() {
// 等待12
// 等待33
try {
Thread.sleep(12000);
Thread.sleep(33000);
} catch (InterruptedException e) {
e.printStackTrace();
}
@@ -57,7 +57,7 @@ public class SwitchBoardScheduler {
String clientId = AgentUtil.getMotherboardUUID();
Message message = Message.builder().clientId(clientId).dataType("SWITCHBOARD").data(data).build();
// 将对象转为 JSON 字符串
String json = "agent-tcp:"+ JSON.toJSONString(message)+"@tong-ran";
String json = JSON.toJSONString(message);
AssertLog.info("发送交换机信息包={}",json);
nettyTcpClient.sendMessage(json);
}
@@ -56,7 +56,7 @@ public class SysScheduler {
String clientId = AgentUtil.getMotherboardUUID();
Message message = Message.builder().clientId(clientId).dataType("SYSTEM").data(data).build();
// 将对象转为 JSON 字符串
String json = "agent-tcp:"+JSON.toJSONString(message)+"@tong-ran";
String json = JSON.toJSONString(message);
AssertLog.info("发送系统信息包={}",json);
nettyTcpClient.sendMessage(json);
}
@@ -26,7 +26,7 @@ public class CpuVO implements Serializable {
private double avg15;
@Schema(description = "CPU硬件中断提供服务时间")
private double interrupt;
private long interrupt;
@Schema(description = "CPU使用率%")
private double uti;
@@ -38,19 +38,19 @@ public class CpuVO implements Serializable {
private long normal;
@Schema(description = "CPU空闲时间")
private double idle;
private long idle;
@Schema(description = "CPU等待响应时间")
private double iowait;
@Schema(description = "CPU系统时间")
private double system;
private long system;
@Schema(description = "CPU软件无响应时间")
private double noresp;
@Schema(description = "CPU用户进程所花费的时间")
private double user;
private long user;