feat(alert-center): 添加飞书Webhook通知渠道 + 告警引擎实时通知

- 后端: NotifyChannel 模型新增 feishu 类型, FeishuWebhookConfig
- 后端: TestNotifyChannel 真实发送飞书测试消息(文本格式)
- 后端: 告警引擎触发/恢复时自动发送飞书通知(sendFeishuAlert/sendFeishuRecovery)
- 后端: AlertEngine 新增 tcp_time_wait/tcp_close_wait/service_process 指标检测
- 后端: NetworkStatModel 新增 TCPCloseWait 字段
- 后端: QuickSetupRules 一键创建6条告警规则(CPU/内存/磁盘/TIME_WAIT/CLOSE_WAIT/进程)
- 后端: 注册 /alerts/quick-setup 路由
- 前端: AlertChannelDialog 新增飞书类型选项
- 前端: helpers 新增 getChannelIcon/getChannelTypeLabel 支持 feishu/dingtalk/wechat
This commit is contained in:
attacker committed 2026-06-24 08:34:43 +00:00
1 parent 7bc5169e8f
commit 5333f6f04a
30 files changed
+2406 -1001

No files matched your search

+35 -5
View File
@@ -18,11 +18,41 @@ type DiskIOStat struct {
WriteIOPS float64 `json:"write_iops"` // 写入 IOPS (count/s)
}
// SwapStat 交换分区指标(OOM 前兆判断)
type SwapStat struct {
TotalGB float64 `json:"total_gb"`
UsedGB float64 `json:"used_gb"`
UsagePercent float64 `json:"usage_percent"`
}
// SocketFDStat 系统级 FD 使用情况
type SocketFDStat struct {
Allocated int `json:"allocated"` // 已分配的 file handles (fs.file-nr 第一列)
Max int64 `json:"max"` // 系统上限 (fs.file-max)
UsagePct float64 `json:"usage_pct"`
}
// ContextSwitchStat 上下文切换(决定是否开中断合并/CPU 隔离)
type ContextSwitchStat struct {
CTXPerSec float64 `json:"ctx_per_sec"` // 每秒上下文切换次数
IRQPerSec float64 `json:"irq_per_sec"` // 每秒中断次数
}
// AgentHeartbeat Agent 自检心跳(随每次上报附带,极小 payload)
type AgentHeartbeat struct {
Version string `json:"version"`
UptimeSec int64 `json:"uptime_sec"`
LastErr string `json:"last_err,omitempty"`
SelfCPU float64 `json:"self_cpu_pct"`
SelfRSSMB float64 `json:"self_rss_mb"`
ReportSeq uint64 `json:"report_seq"` // 单调递增序列号,用于丢包检测
}
// SystemStat 系统信息(启动时采集一次)
type SystemStat struct {
OSVersion string `json:"os_version"` // OS 版本 (如 "Ubuntu 22.04")
Kernel string `json:"kernel"` // 内核版本
Uptime int64 `json:"uptime"` // 运行秒数
UlimitNofile int64 `json:"ulimit_nofile"` // ulimit -n (最大文件描述符)
UlimitNproc int64 `json:"ulimit_nproc"` // ulimit -u (最大进程数)
OSVersion string `json:"os_version"` // OS 版本 (如 "Ubuntu 22.04")
Kernel string `json:"kernel"` // 内核版本
Uptime int64 `json:"uptime"` // 运行秒数
UlimitNofile int64 `json:"ulimit_nofile"` // ulimit -n (最大文件描述符)
UlimitNproc int64 `json:"ulimit_nproc"` // ulimit -u (最大进程数)
}