该技能是事故分诊、SLO 监控与通知验证的入口,编排从检测到解决的完整分诊流程,并可交叉引用 cx-alerts(深度告警管理)与 cx-telemetry-querying(根因调查)。
【主要命令】
- cx incidents:list、get、acknowledge、resolve、close、assign、unassign、events、aggregations,用于管理与分诊事故。
- cx slos:list、get、create、update、delete,用于监控和管理 SLO 定义。
- cx alerts:list、get,查看正在触发的告警(完整告警管理见 cx-alerts 技能)。
- cx notifications connectors:list、get,验证通知连接器配置。
- cx notifications routers:list、get,验证通知路由规则。
- cx notifications presets:list、get,检查通知预设模板。
- cx notifications test:connector、destination、preset、routing-condition、template-render,测试通知投递。
【关键参数】 cx incidents list 支持可重复过滤器:--status(TRIGGERED、ACKNOWLEDGED、RESOLVED)、--severity(INFO、WARNING、ERROR、CRITICAL)、--state(TRIGGERED、RESOLVED)、--assignee、--application-name、--subsystem-name、--contextual-label key=value、--query、--muting muted|unmuted、--start/--end、--duration-start/--duration-end。 cx incidents list 每个 profile 默认最多返回 100 条事故;可用 --limit <n> 限制每 profile 结果集,用 --page-size <n>/--page-token <token> 手动分页,仅在明确需要全部页面时使用 --all。 所有命令支持 -o json 结构化输出与 -p <profile> 选择 profile。 cx slos create/update 使用 --from-file <path>(或 - 表示 stdin)。
【事故分诊工作流】
- 检查活动事故:cx incidents list -o json;可按状态、严重级别、时间范围过滤,并用 jq 提取 id、name、state、severity、created_at 等。
- 查看事故详情:cx incidents get <incident-id> -o json;cx incidents events --incident-id <incident-id> -o json,查看时间线与相关事件。
- 检查相关告警:cx alerts list -o json,筛选 is_active 为 true 的告警。
- 检查 SLO 状态:cx slos list -o json;cx slos get <slo-id> -o json,查看是否违约或错误预算被消耗。
- 验证通知:分别列出 connectors、routers、presets,确认正确的对象通过正确渠道被通知。
- 转向根因:切换到 cx-telemetry-querying 技能,用日志、链路追踪、指标调查底层原因。
【事故操作】 确认:cx incidents acknowledge <incident-id>,可一次确认多个 ID。 解决:cx incidents resolve <incident-id>,可一次解决多个 ID。 指派:cx incidents assign <incident-id> --user-id <user-id>。 关闭:cx incidents close <incident-id>。
【SLO 管理】 从现有 SLO 创建模板:cx slos get <existing-slo-id> -o json > slo-template.json,编辑后执行 cx slos create --from-file slo-template.json。 监控 SLO 健康:cx slos list -o json 并用 jq 提取 name、status、target_percentage、remaining_budget;筛选 status 不为 OK 的违约 SLO。
【通知调试】 当通知未到达正确对象时:1)检查连接器,确认 Slack、PagerDuty、邮件等渠道存在且已配置;2)检查路由器,确认路由规则将正确的告警类型映射到正确的连接器;3)测试通知投递:cx notifications test connector/destination/preset/routing-condition 搭配 --from-file。
【事故聚合】 cx incidents aggregations -o json,用于了解事故频率、MTTR 趋势与严重级别分布。
【关键原则】 先分诊再深挖,先检查事故、告警与 SLO,再查询遥测数据;关注 SLO 燃烧速率而不仅是状态;端到端验证通知链路(连接器存在→路由映射正确→投递测试通过);分诊后交叉引用遥测进行根因定位;及时确认事故以表明责任归属并停止重复通知;使用事故事件查看完整生命周期。
【相关技能】 cx-alerts:深度告警管理(创建、更新、检查告警定义);cx-telemetry-querying:使用日志、指标、链路追踪与 RUM 进行根因调查;cx-observability-setup:为告警配置通知渠道与路由。