feat: Agent采集uptime, 后端持久化kernel/uptime/diskIO, 前端磁盘BPS+IOPS展示

- Agent: system.go 添加 readUptime(), SystemStat 携带 Uptime
- Backend: Server 模型新增 Kernel 字段, ReceiveReport 持久化 kernel+uptime
- Backend: /agent/latest 返回 kernel/uptime/port_info/disk_io_info/disk_total
- Frontend: 磁盘监控改为 BPS+IOPS (4张卡片), 系统信息修复内核/运行时长/监听端口/磁盘容量
- 图表单位从 MB/s 改为 KB/s, 添加 formatBPS 工具函数
This commit is contained in:
attacker committed 2026-06-19 01:10:00 +00:00
1 parent 31c2e338a3
commit 5949ec5d0c
48 files changed
+2182 -956

No files matched your search

+3 -7
View File
@@ -3,7 +3,6 @@ package models
import (
"time"
"gorm.io/gorm"
)
// AgentTask Agent 远程任务 // Logan.Li
@@ -22,11 +21,10 @@ type AgentTask struct {
PickedAt *time.Time `json:"picked_at"` // Agent 拉取时间
FinishedAt *time.Time `json:"finished_at"` // 完成时间
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}
func (AgentTask) TableName() string {
return "agent_tasks"
return "monitor_agent_tasks"
}
// AgentRule 告警规则(基于 Agent 数据) // Logan.Li
@@ -42,11 +40,10 @@ type AgentRule struct {
LastTriggered *time.Time `json:"last_triggered"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}
func (AgentRule) TableName() string {
return "agent_rules"
return "monitor_agent_rules"
}
// AgentAlert Agent 告警事件 // Logan.Li
@@ -63,9 +60,8 @@ type AgentAlert struct {
ResolvedAt *time.Time `json:"resolved_at"`
CreatedAt time.Time `gorm:"index" json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}
func (AgentAlert) TableName() string {
return "agent_alerts"
return "monitor_agent_alerts"
}