feat: 重构监控中心导航,新增资源监控4大模块

- 主菜单「监控告警」→「监控中心」
- 「告警中心」→「告警服务」移至链路追踪下方
- 新增资源监控 Tab 页(主机/中间件/SNMP/站点拨测)
- Agent 新增网络采集器(network)和磁盘IO采集器(diskio)
- 后端扩展 Agent 上报模型,支持 NetworkStat/DiskIOStat
- 前端 ServerTableRow 展示网络和磁盘IO实时指标
- WebSocket MetricsUpdate 推送扩展
This commit is contained in:
attacker committed 2026-06-18 09:30:45 +00:00
1 parent 020b7a9063
commit f3a9e5e8d0
21 files changed
+1007 -32

No files matched your search

+26 -4
View File
@@ -20,6 +20,8 @@ type AgentReport struct {
MemUsage float64 `gorm:"type:decimal(6,2)" json:"mem_usage"` // 内存使用率 %
DiskInfo string `gorm:"type:text" json:"disk_info"` // 磁盘信息 JSON
PortInfo string `gorm:"type:text" json:"port_info"` // 端口信息 JSON
NetInfo string `gorm:"type:text" json:"net_info"` // 网络指标 JSON
DiskIOInfo string `gorm:"type:text" json:"disk_io_info"` // 磁盘 IO JSON
ReportTime time.Time `json:"report_time"` // 上报时间
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
@@ -32,12 +34,14 @@ func (AgentReport) TableName() string {
// AgentReportRequest Agent 上报请求体 // Logan.Li
type AgentReportRequest struct {
Hostname string `json:"hostname"`
Timestamp string `json:"timestamp"`
CPU CPUMetric `json:"cpu"`
Memory MemMetric `json:"memory"`
Hostname string `json:"hostname" binding:"required"`
Timestamp string `json:"timestamp"`
CPU CPUMetric `json:"cpu"`
Memory MemMetric `json:"memory"`
Disks []DiskMetric `json:"disks"`
Ports []PortMetric `json:"ports"`
Network NetworkStat `json:"network"` // 网络指标
DiskIO DiskIOStat `json:"disk_io"` // 磁盘 IO
}
type CPUMetric struct {
@@ -69,3 +73,21 @@ type PortMetric struct {
Process string `json:"process"`
PID int `json:"pid"`
}
// NetworkStat 网络指标(Agent 上报)
type NetworkStat struct {
TCPEstablished int `json:"tcp_established"`
TCPTimeWait int `json:"tcp_time_wait"`
TCPTotal int `json:"tcp_total"`
NicName string `json:"nic_name"`
NetRxBPS float64 `json:"net_rx_bps"`
NetTxBPS float64 `json:"net_tx_bps"`
}
// DiskIOStat 磁盘 IO 指标(Agent 上报)
type DiskIOStat struct {
ReadBPS float64 `json:"read_bps"`
WriteBPS float64 `json:"write_bps"`
ReadIOPS float64 `json:"read_iops"`
WriteIOPS float64 `json:"write_iops"`
}