用途:在 DevOps 环境中管理安全事件的完整响应生命周期,包括检测、分析、遏制与恢复,适用于监控发现流水线异常、正在发生的入侵或计划演练,也可嵌入 SRE 工作流以减少停机。
主要能力:检测通过 API 端点 /api/incident/detect 扫描日志与指标,JSON 载荷如 {"source": "k8s-logs", "threshold": 0.8};分析用 --analyze-depth 2 关联事件;遏制可隔离受影响资源,如 openclaw incident contain --resource pod-123 --action pause;恢复支持回滚或从备份还原,如调用 /api/incident/recover 并传 {"backup_id": "snapshot-456"}。支持与 Prometheus 等监控工具集成。
使用方式:先设置 export OPENCLAW_API_KEY=your_api_key,再运行 openclaw auth --key $OPENCLAW_API_KEY 初始化。典型流程为 openclaw incident detect --env prod --type network、openclaw incident analyze --id 123 --format json、openclaw incident contain --id 123 --scope cluster、openclaw incident recover --id 123 --backup latest。API 端点均需 Authorization 头,配置可用 JSON 文件经 --config 传入。
限制:需自行校验输入以避免误报;CLI 退出码 0 成功、1 检测错误、2 API 失败,HTTP 400/401 分别对应请求错误与认证问题;具体收费、平台支持与效果暂未提供。