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:
1 parent
31c2e338a3
commit
5949ec5d0c
48 files changed
+2182
-956
No files matched your search
@@ -135,7 +135,7 @@ func Register(r *gin.Engine, db *gorm.DB, log *zap.Logger, cfg *config.Config, c
|
||||
}
|
||||
|
||||
// 服务器路由
|
||||
serverHandler := handlers.NewServerHandler(db)
|
||||
serverHandler := handlers.NewServerHandler(db, cfg.JWT.Secret)
|
||||
servers := authorized.Group("/servers")
|
||||
{
|
||||
servers.GET("", serverHandler.ListServers)
|
||||
@@ -434,7 +434,7 @@ func Register(r *gin.Engine, db *gorm.DB, log *zap.Logger, cfg *config.Config, c
|
||||
{
|
||||
agentQuery.GET("/latest", agentHandler.GetLatestReports)
|
||||
agentQuery.GET("/history/:hostname", agentHandler.GetHostHistory)
|
||||
agentQuery.GET("/kline", agentHandler.GetKline)
|
||||
agentQuery.GET("/aggregate", agentHandler.GetAggregate)
|
||||
|
||||
// 远程任务
|
||||
agentQuery.POST("/tasks", taskHandler.CreateTask)
|
||||
@@ -451,6 +451,10 @@ func Register(r *gin.Engine, db *gorm.DB, log *zap.Logger, cfg *config.Config, c
|
||||
// 告警事件
|
||||
agentQuery.GET("/alerts", taskHandler.ListAlerts)
|
||||
agentQuery.POST("/alerts/:id/resolve", taskHandler.ResolveAlert)
|
||||
|
||||
// Agent 安装/卸载
|
||||
agentQuery.POST("/uninstall", agentInstallHandler.UninstallAgent)
|
||||
agentQuery.POST("/batch-uninstall", agentInstallHandler.BatchUninstallAgent)
|
||||
}
|
||||
|
||||
// AI 智能助手 - LLM 配置 + 对话代理(OpenAI 兼容) // Logan.Li
|
||||
@@ -535,6 +539,18 @@ func Register(r *gin.Engine, db *gorm.DB, log *zap.Logger, cfg *config.Config, c
|
||||
zabbixDSGroup.POST("/test", zabbixDSHandler.TestConnection)
|
||||
}
|
||||
|
||||
// 凭据管理 — SSH密钥/API Token/密码统一加密管理 // Logan.Li
|
||||
credentialHandler := handlers.NewCredentialHandler(db, cfg.JWT.Secret)
|
||||
credGroup := authorized.Group("/credentials")
|
||||
{
|
||||
credGroup.GET("", credentialHandler.ListCredentials)
|
||||
credGroup.POST("", credentialHandler.CreateCredential)
|
||||
credGroup.PUT("/:id", credentialHandler.UpdateCredential)
|
||||
credGroup.DELETE("/:id", credentialHandler.DeleteCredential)
|
||||
}
|
||||
// 服务器凭据关联 // Logan.Li
|
||||
authorized.POST("/servers/:id/assign-credential", credentialHandler.AssignCredential)
|
||||
|
||||
// 站点拨测 — HTTP/TCP/DNS/PING 主动监控 // Logan.Li
|
||||
siteHandler := handlers.NewSiteHandler(db)
|
||||
siteGroup := authorized.Group("/site")
|
||||
|
||||
Reference in new issue
Block a user