This commit is contained in:
Logan committed 2026-07-09 14:16:56 +08:00
1 parent 0690285147
commit 5618cd2738
154 files changed
+5021 -3161

No files matched your search

+16 -16
View File
@@ -134,15 +134,15 @@ func (h *MetricsHandler) TopHosts(c *gin.Context) {
limit, _ := strconv.Atoi(c.DefaultQuery("limit", "5"))
type HostRank struct {
Hostname string `json:"hostname"`
IP string `json:"ip"`
CPUUsage float64 `json:"cpu_usage"`
MemUsage float64 `json:"memory_usage"`
Hostname string `json:"hostname"`
IP string `json:"ip"`
CPUUsage float64 `json:"cpu_usage"`
MemUsage float64 `json:"memory_usage"`
DiskUsage float64 `json:"disk_usage"`
CPUCores int `json:"cpu_cores"`
MemMB int64 `json:"memory_mb"`
DiskGB int64 `json:"disk_gb"`
Status string `json:"status"`
CPUCores int `json:"cpu_cores"`
MemMB int64 `json:"memory_mb"`
DiskGB int64 `json:"disk_gb"`
Status string `json:"status"`
}
var servers []model.Server
@@ -166,15 +166,15 @@ func (h *MetricsHandler) TopHosts(c *gin.Context) {
result := make([]HostRank, len(servers))
for i, s := range servers {
result[i] = HostRank{
Hostname: s.Hostname,
IP: s.IP,
CPUUsage: s.CPUUsage,
MemUsage: s.MemoryUsage,
Hostname: s.Hostname,
IP: s.IP,
CPUUsage: s.CPUUsage,
MemUsage: s.MemoryUsage,
DiskUsage: s.DiskUsage,
CPUCores: s.CPU,
MemMB: s.Memory,
DiskGB: s.Disk,
Status: s.Status,
CPUCores: s.CPU,
MemMB: s.Memory,
DiskGB: s.Disk,
Status: s.Status,
}
}
if result == nil {