package model import ( "time" ) type SystemStatus struct { CPU struct { Usage float64 `json:"usage"` // CPU使用率 LoadAvg []float64 `json:"load_avg"` // 系统负载 CoreCount int `json:"core_count"` // CPU核心数 ModelName string `json:"model_name"` // CPU型号 MHz float64 `json:"mhz"` // CPU频率 } `json:"cpu"` Memory struct { Total uint64 `json:"total"` // 总内存 Used uint64 `json:"used"` // 已用内存 Free uint64 `json:"free"` // 空闲内存 UsageRate float64 `json:"usage_rate"` // 使用率 SwapTotal uint64 `json:"swap_total"` // 交换分区总大小 SwapUsed uint64 `json:"swap_used"` // 交换分区已用 SwapFree uint64 `json:"swap_free"` // 交换分区空闲 SwapUsageRate float64 `json:"swap_usage_rate"` // 交换分区使用率 } `json:"memory"` Disk struct { Partitions []DiskPartition `json:"partitions"` // 磁盘分区信息 } `json:"disk"` Network struct { Interfaces []NetworkInterface `json:"interfaces"` // 网络接口信息 } `json:"network"` Process struct { Total int `json:"total"` // 进程总数 List []ProcessInfo `json:"list"` // 进程列表(Top N) } `json:"process"` Host struct { Hostname string `json:"hostname"` // 主机名 OS string `json:"os"` // 操作系统 Platform string `json:"platform"` // 平台 PlatformVersion string `json:"platform_version"` // 平台版本 KernelVersion string `json:"kernel_version"` // 内核版本 BootTime time.Time `json:"boot_time"` // 启动时间 } `json:"host"` System struct { Uptime time.Duration `json:"uptime"` // 系统运行时间 CurrentTime time.Time `json:"current_time"` // 当前时间 ActiveUsers int `json:"active_users"` // 活跃用户数 TotalDevices int `json:"total_devices"` // 设备总数 } `json:"system"` } type DiskPartition struct { Device string `json:"device"` // 设备名 Mountpoint string `json:"mountpoint"` // 挂载点 Fstype string `json:"fstype"` // 文件系统类型 Total uint64 `json:"total"` // 总空间 Used uint64 `json:"used"` // 已用空间 Free uint64 `json:"free"` // 空闲空间 UsageRate float64 `json:"usage_rate"` // 使用率 } type NetworkInterface struct { Name string `json:"name"` // 接口名称 BytesSent uint64 `json:"bytes_sent"` // 发送字节数 BytesRecv uint64 `json:"bytes_recv"` // 接收字节数 PacketsSent uint64 `json:"packets_sent"` // 发送包数 PacketsRecv uint64 `json:"packets_recv"` // 接收包数 Addrs []string `json:"addrs"` // IP地址列表,改为字符串数组 } type ProcessInfo struct { PID int `json:"pid"` // 进程ID Name string `json:"name"` // 进程名称 CPU float64 `json:"cpu"` // CPU使用率 Memory float64 `json:"memory"` // 内存使用率 Created int64 `json:"created"` // 创建时间 }