Merge remote-tracking branch 'origin/local-ss' into local-ss

This commit is contained in:
zeaslity
2024-04-29 10:04:08 +08:00
5 changed files with 52 additions and 11 deletions

View File

@@ -254,14 +254,14 @@ func refreshAgentInfoByStatusInfo(agentInfo *a_status.AgentInfo, agentServerInfo
// cpu part
agentServerInfo.CPUCore = strconv.FormatInt(int64(agentInfo.CPUInfo.NumCores), 10)
if len(agentInfo.CPUInfo.CPUInfo) > 0 {
marshal, _ := json.Marshal(agentInfo.CPUInfo.CPUInfo[0])
marshal, _ := json.Marshal(agentInfo.CPUInfo.CPUInfo[0].ModelName)
agentServerInfo.CPUBrand = string(marshal)
}
// os info
agentServerInfo.OSInfo = agentInfo.HostInfo.PlatformFamily + agentInfo.HostInfo.Platform + agentInfo.HostInfo.PlatformVersion
agentServerInfo.OSInfo = agentInfo.HostInfo.PlatformFamily + " " + agentInfo.HostInfo.Platform + " " + agentInfo.HostInfo.PlatformVersion
agentServerInfo.OSKernelInfo = agentInfo.HostInfo.KernelVersion
agentServerInfo.Virtualization = agentInfo.HostInfo.VirtualizationSystem + agentInfo.HostInfo.VirtualizationRole
agentServerInfo.Virtualization = agentInfo.HostInfo.VirtualizationSystem + " " + agentInfo.HostInfo.VirtualizationRole
agentServerInfo.Platform = agentInfo.HostInfo.Platform
agentServerInfo.PlatformFamily = agentInfo.HostInfo.PlatformFamily
agentServerInfo.PlatformVersion = agentInfo.HostInfo.PlatformVersion
@@ -269,8 +269,8 @@ func refreshAgentInfoByStatusInfo(agentInfo *a_status.AgentInfo, agentServerInfo
agentServerInfo.KernelArch = agentInfo.HostInfo.KernelArch
// memory part
agentServerInfo.MemoryTotal = strconv.FormatInt(int64(agentInfo.MemoryInfo.TotalMemory), 10)
agentServerInfo.SwapTotal = strconv.FormatInt(int64(agentInfo.MemoryInfo.SwapTotal), 10)
agentServerInfo.MemoryTotal = utils.ByteSizeToString(agentInfo.MemoryInfo.TotalMemory)
agentServerInfo.SwapTotal = utils.ByteSizeToString(agentInfo.MemoryInfo.SwapTotal)
// disk part
info := agentInfo.DiskInfo
@@ -283,8 +283,8 @@ func refreshAgentInfoByStatusInfo(agentInfo *a_status.AgentInfo, agentServerInfo
diskUsage = diskInfo.Used
}
}
agentServerInfo.DiskTotal = strconv.FormatUint(diskTotal, 10)
agentServerInfo.DiskUsage = strconv.FormatUint(diskUsage, 10)
agentServerInfo.DiskTotal = utils.ByteSizeToString(diskTotal)
agentServerInfo.DiskUsage = utils.ByteSizeToString(diskUsage)
// network part
refreshAgentNetworkInfo(agentInfo, agentServerInfo)