mcpField
C
cx-observability-setup

cx-observability-setup

github.com/coralogix云与 DevOps2153.6k 次安装今天更新
代码仓库

关于 cx-observability-setup

cx-observability-setup 是用于配置 Coralogix 可观测性环境的技能,面向新服务接入或通知链路调整。它通过 CLI 管理保存视图、通知、Webhook 和集成,并提供测试配置的工作流程。

主要功能

  1. 01管理保存视图及文件夹
  2. 02配置 Webhook 和自动化操作
  3. 03管理通知连接器、路由与预设
  4. 04创建和部署集成及扩展
  5. 05测试通知、Webhook 和集成配置

适用场景

  1. 01为新服务创建保存视图
  2. 02将告警路由到合适通知渠道
  3. 03配置并验证外部 Webhook
  4. 04部署服务所需的集成扩展

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/coralogix/cx-cli --skill cx-observability-setup

安装后在 Claude Code 中输入/cx-observability-setup确认已加载。

详细介绍

可观测性设置技能

在设置或配置可观测性技术栈时使用此技能,包括已保存视图、Webhook 集成、通知渠道和外部集成。这是一项用于新服务接入或重新配置通知管道的“第 1 天设置”技能。


CLI 命令

视图
命令用途
cx views list列出所有已保存视图
cx views get <id>获取视图定义
cx views create --from-file创建已保存视图
cx views update <id> --from-file更新已保存视图
cx views delete <id>删除已保存视图
cx views folders list列出视图文件夹
cx views folders get <id>获取文件夹
cx views folders create --from-file创建文件夹
cx views folders update <id> --from-file更新文件夹
cx views folders delete <id>删除文件夹
Webhook
命令用途
cx webhooks list列出所有外发 Webhook
cx webhooks get <id>获取 Webhook 详情
cx webhooks create --from-file创建 Webhook
cx webhooks update <id> --from-file更新 Webhook
cx webhooks delete <id>删除 Webhook
cx webhooks test <id>测试 Webhook
cx webhooks types列出可用的 Webhook 类型
cx webhooks actions list列出自动化操作
cx webhooks actions get <id>获取操作详情
cx webhooks actions create --from-file创建操作
cx webhooks actions update --from-file更新操作
cx webhooks actions delete <id>删除操作
cx webhooks actions batch --from-file批量执行操作
cx webhooks actions reorder --from-file重新排列操作
通知
命令用途
cx notifications connectors list列出通知连接器
cx notifications connectors get <id>获取连接器详情
cx notifications connectors create --from-file创建连接器
cx notifications connectors update --from-file更新连接器
cx notifications connectors delete <id>删除连接器
cx notifications connectors types列出连接器类型
cx notifications connectors entity-types列出实体类型
cx notifications connectors entity-subtypes --type <type>列出实体子类型
cx notifications routers list列出通知路由器
cx notifications routers get <id>获取路由器详情
cx notifications routers create --from-file创建路由器
cx notifications routers update --from-file更新路由器
cx notifications routers delete <id>删除路由器
cx notifications routers validate-matcher --from-file测试实体标签匹配器
cx notifications presets list列出通知预设
cx notifications presets get <id>获取预设详情
cx notifications presets create --from-file创建自定义预设
cx notifications presets update --from-file更新自定义预设
cx notifications presets delete <id>删除自定义预设
cx notifications presets set-default <id>设置默认预设
cx notifications test connector --from-file测试连接器配置
cx notifications test destination --from-file测试目标
cx notifications test preset --from-file测试预设配置
cx notifications test routing-condition --from-file测试路由条件
cx notifications test template-render --from-file测试模板渲染
集成
命令用途
cx integrations list列出所有集成
cx integrations get <id>获取集成详情
cx integrations create --from-file创建集成
cx integrations update <id> --from-file更新集成
cx integrations delete <id>删除集成
cx integrations test --from-file测试集成配置
cx integrations template获取集成模板
cx integrations definition <id>获取集成定义
cx integrations deployed <id>获取已部署的集成
cx integrations extensions list列出可用扩展
cx integrations extensions get <id>获取扩展详情
cx integrations extensions deployed列出已部署的扩展
cx integrations extensions deploy --from-file部署扩展
cx integrations extensions update --from-file更新已部署的扩展
cx integrations extensions undeploy --from-file取消部署扩展
cx integrations contextual-data list列出上下文数据集成
cx integrations contextual-data get <id>获取上下文数据详情
cx integrations contextual-data create --from-file创建上下文数据集成
cx integrations contextual-data update <id> --from-file更新上下文数据集成
cx integrations contextual-data delete <id>删除上下文数据集成
cx integrations contextual-data definition <id>获取上下文数据定义
cx integrations contextual-data test <id>测试上下文数据集成

所有命令均支持 -o json 以输出结构化数据,并支持 -p <profile> 以选择配置文件。


新服务设置工作流

接入新服务时,请按照以下清单操作:

1. 创建已保存视图

为服务的关键日志查询设置视图:

cx views folders create --from-file folder.json
cx views create --from-file view.json
2. 设置通知连接器

配置渠道(Slack、PagerDuty、电子邮件):

cx notifications connectors types -o json
cx notifications connectors create --from-file slack-connector.json
3. 配置通知路由

将告警路由到正确的渠道:

cx notifications routers create --from-file router.json
4. 设置 Webhook

配置用于外部集成的出站 Webhook:

cx webhooks types -o json
cx webhooks create --from-file webhook.json
cx webhooks test <webhook-id>
5. 安装集成

部署相关集成和扩展:

cx integrations list -o json
cx integrations create --from-file integration.json
cx integrations extensions deploy --from-file extension.json
6. 创建仪表板

使用 cx-dashboards 技能了解完整的仪表板创建工作流。

7. 创建 SLO

使用 cx-slos 技能创建并监控 SLO。


通知设置工作流

通知渠道配置详解:

1. 列出可用的连接器类型
cx notifications connectors types -o json
2. 创建连接器
cx notifications connectors create --from-file connector.json
3. 创建路由器
cx notifications routers create --from-file router.json
4. 指定或创建预设
cx notifications presets list -o json
cx notifications presets create --from-file preset.json
cx notifications presets set-default <preset-id>
5. 端到端测试
cx notifications test connector --from-file test-connector.json
cx notifications test destination --from-file test-destination.json
cx notifications test routing-condition --from-file test-condition.json

Webhook 设置

1. 列出 Webhook 类型
cx webhooks types -o json
2. 创建 Webhook

如果可能,请使用现有 Webhook 创建模板:

cx webhooks get <existing-id> -o json > webhook-template.json
cx webhooks create --from-file webhook.json
3. 测试 Webhook
cx webhooks test <webhook-id>
4. 创建自动化操作(可选)
cx webhooks actions create --from-file action.json
cx webhooks actions reorder --from-file order.json

关键原则

  • 设置后务必测试——使用 cx notifications test、cx webhooks test、cx integrations test
  • 复杂 JSON 负载请使用 --from-file——通过标准输入传入,或使用文件
  • 根据现有配置创建模板——创建前运行 cx <command> get <id> -o json > template.json
  • 先检查连接器类型——创建前运行 cx notifications connectors types 和 cx webhooks types

相关技能

  • cx-dashboards——仪表板创建和替换工作流
  • cx-slos——SLO 创建和错误预算监控
  • cx-cases——对告警触发后生成的案例进行分流处理
  • cx-alerts——触发通知的告警定义
  • cx-telemetry-querying——设置后验证数据流

评论

支持 Markdown