2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 11:27:17 +08:00

feat: 监控显示优化

This commit is contained in:
2026-01-12 19:29:57 +08:00
parent 58f303c751
commit 87420648b3
4 changed files with 896 additions and 440 deletions

View File

@@ -66,7 +66,7 @@ func CurrentInfo(nets, disks []string) types.CurrentInfo {
}
// 网络
if len(nets) == 0 {
netInfo, _ := net.IOCounters(false)
netInfo, _ := net.IOCounters(true)
res.Net = netInfo
} else {
var netStats []net.IOCountersStat

View File

@@ -22,18 +22,30 @@ type SWAP struct {
Free []string `json:"free"`
}
// Network 网卡数据
type Network struct {
Name string `json:"name"`
Sent []string `json:"sent"`
Recv []string `json:"recv"`
Tx []string `json:"tx"`
Rx []string `json:"rx"`
}
type MonitorData struct {
Times []string `json:"times"`
Load Load `json:"load"`
CPU CPU `json:"cpu"`
Mem Mem `json:"mem"`
SWAP SWAP `json:"swap"`
Net Network `json:"net"`
// DiskIO 磁盘IO数据
type DiskIO struct {
Name string `json:"name"`
ReadBytes []string `json:"read_bytes"`
WriteBytes []string `json:"write_bytes"`
ReadSpeed []string `json:"read_speed"`
WriteSpeed []string `json:"write_speed"`
}
type MonitorDetail struct {
Times []string `json:"times"`
Load Load `json:"load"`
CPU CPU `json:"cpu"`
Mem Mem `json:"mem"`
SWAP SWAP `json:"swap"`
Net []Network `json:"net"`
DiskIO []DiskIO `json:"disk_io"`
}