1
0
Files
DiAL/openspec/changes/add-icmp-checker/proposal.md
lanyuanxiaoyao 393e8da5fd feat: 新增 ICMP/Ping checker 设计提案
- 定义 ping target 配置:host、count、packetSize
- 定义 ping expect 断言:alive、maxPacketLoss、maxAvgLatencyMs、maxMaxLatencyMs
- 设计跨平台 ping 输出解析器(Linux/macOS/Windows 含多语言支持)
- 双重超时保障:ping 命令自身超时 + AbortSignal 兜底
- 扩展 checker-runner-abstraction spec 支持 ping checker 子进程控制
- 更新 probe-config spec 支持 ping type 配置
2026-05-18 00:33:11 +08:00

29 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## Why
项目当前支持 HTTP、CMD、DB、TCP 四种 checker缺少最基础的网络层存活检测能力。ICMP Ping 是运维监控的基石——主机存活、网络延迟、丢包率是判断网络健康的第一手指标,也是区分"网络层故障"与"应用层故障"的关键手段。
## What Changes
- 新增 `type: ping` checker通过调用系统 `ping` 命令实现 ICMP 探测
- 支持配置 host、count包数量、packetSize包大小用于 MTU 测试)
- 支持断言alive可达性、maxAvgLatencyMs平均延迟、maxMaxLatencyMs最大延迟/抖动、maxPacketLoss丢包率、maxDurationMs整体耗时
- 自行实现跨平台Linux/macOS/Windowsping 输出解析器,不引入三方库
- 文档注明 ICMP checker 依赖系统 `ping` 命令存在(容器环境需确保已安装,如 Alpine 需 `iputils-ping`
## Capabilities
### New Capabilities
- `icmp-checker`: 定义 ICMP/Ping checker 的配置格式、命令执行、跨平台输出解析、expect 校验和状态摘要
### Modified Capabilities
- `checker-runner-abstraction`: 超时控制 requirement 中"仅 cmd checker 可在 signal abort 时 proc.kill()"需扩展为"cmd checker 和 ping checker",因为 ping checker 同样 spawn 子进程
- `probe-config`: 配置格式需扩展支持 `type: ping` 的 target 配置、`ping` 领域分组和对应的 expect 字段
## Impact
- 后端代码:新增 `src/server/checker/runner/icmp/` 模块,注册到 CheckerRegistry
- 配置 schema`probe-config.schema.json` 需更新,新增 ping target 和 expect 的 schema 片段
- 测试:新增 `tests/server/checker/runner/icmp/` 测试套件
- 文档README.md 和 DEVELOPMENT.md 需更新,注明 ping 命令的系统依赖
- 无新增三方依赖