feat: v0.34 健康探针(Architecture B) + Agent v2.1 + 端口监控 + 告警联系人重构
- v0.31: AlertContact 重构(channel_type下拉+webhook_url替代三分立字段) - v0.32: Agent ProcessTop 增强(cmdline/user/cpu_pct/mem_pct) - v0.33: 端口监控 Tab(监听端口自动发现+down联动告警) - v0.34: 健康探针(Agent本地执行HTTP/TCP/Exec→结果随心跳上报) - Agent新增: ContextSwitch/FD/HealthProbe采集器 - 后端新增: health_probe handler + Agent model扩展 - HostMonitor新增Tab: 健康探针/端口监控
This commit is contained in:
1 parent
e1f75f0bc4
commit
d656520428
25 files changed
+1700
-619
No files matched your search
@@ -22,6 +22,7 @@ type Report struct {
|
||||
FD *SocketFDStat `json:"fd,omitempty"` // 系统文件句柄
|
||||
ContextSwitches *ContextSwitchStat `json:"context_switches,omitempty"` // 上下文切换
|
||||
Heartbeat AgentHeartbeat `json:"heartbeat"` // Agent 自检
|
||||
ProbeResults []ProbeResult `json:"probe_results,omitempty"` // v2.1 健康探针结果
|
||||
}
|
||||
|
||||
// CPUStat CPU 相关指标
|
||||
|
||||
@@ -56,3 +56,31 @@ type SystemStat struct {
|
||||
UlimitNofile int64 `json:"ulimit_nofile"` // ulimit -n (最大文件描述符)
|
||||
UlimitNproc int64 `json:"ulimit_nproc"` // ulimit -u (最大进程数)
|
||||
}
|
||||
|
||||
// ──── v2.1 健康探针 ────
|
||||
|
||||
// ProbeConfig 后端下发的探针配置
|
||||
type ProbeConfig struct {
|
||||
ID uint `json:"id"`
|
||||
Name string `json:"name"`
|
||||
ProbeType string `json:"probe_type"` // http_get / tcp_socket / exec_command
|
||||
HTTPURL string `json:"http_url,omitempty"`
|
||||
HTTPMethod string `json:"http_method,omitempty"`
|
||||
HTTPExpectCode int `json:"http_expect_code,omitempty"`
|
||||
HTTPExpectBody string `json:"http_expect_body,omitempty"`
|
||||
TCPHost string `json:"tcp_host,omitempty"`
|
||||
TCPPort int `json:"tcp_port,omitempty"`
|
||||
ExecCommand string `json:"exec_command,omitempty"`
|
||||
Timeout int `json:"timeout"`
|
||||
}
|
||||
|
||||
// ProbeResult 探针执行结果
|
||||
type ProbeResult struct {
|
||||
ProbeID uint `json:"probe_id"`
|
||||
Name string `json:"name"`
|
||||
ProbeType string `json:"probe_type"`
|
||||
Status string `json:"status"` // up / down
|
||||
LatencyMs int `json:"latency_ms"`
|
||||
StatusCode int `json:"status_code,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
@@ -1,10 +1,14 @@
|
||||
package model
|
||||
|
||||
// ProcessStat 单个进程统计(TOP N 采集)
|
||||
// ProcessStat 单个进程统计(TOP N 采集)— 阿里云风格
|
||||
type ProcessStat struct {
|
||||
PID int `json:"pid"`
|
||||
Name string `json:"name"`
|
||||
MemoryMB float64 `json:"memory_mb"` // 物理内存 (MB)
|
||||
FDCount int `json:"fd_count"` // 打开的文件句柄数
|
||||
Threads int `json:"threads"` // 线程数
|
||||
PID int `json:"pid"`
|
||||
Name string `json:"name"` // 进程名(comm)
|
||||
Cmdline string `json:"cmdline"` // 完整命令行
|
||||
User string `json:"user"` // 运行用户
|
||||
CPUPct float64 `json:"cpu_pct"` // CPU 使用率 (%)
|
||||
MemPct float64 `json:"mem_pct"` // 内存使用率 (%)
|
||||
MemoryMB float64 `json:"memory_mb"` // 物理内存 (MB)
|
||||
FDCount int `json:"fd_count"` // 打开的文件句柄数
|
||||
Threads int `json:"threads"` // 线程数
|
||||
}
|
||||
Reference in new issue
Block a user