OceanBase Diagnostic Tool (obdiag)
$ obdiag 官方出品 低风险obdiag(OceanBase Diagnostic Tool)是 OceanBase 官方基于 MulanPSL-2.0 协议开源的 Python 诊断工具,覆盖 obdiag check(支持 JSON/YAML/Table 报告)、支持日志脱敏的 obdiag gather、obdiag analyze、obdiag rca 以及实时 obdiag display。
https://github.com/oceanbase/obdiag/releases obdiag 在本地直接完成分布式节点日志抓取、火焰图采样与根因分析,无需将集群节点 SSH 暴露给 MCP 服务。
核心事实概览
- 命令名
- $ obdiag
- FCRS-1.0 总分
- 75/100 (良好 (Good))
- 证据置信度
- 中置信度 (源码/文档)
- CLI vs MCP 建议
- 优先选 CLI
- 评测日期
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
obdiag check run 支持输出 JSON/YAML 报告,并支持无交互场景参数(--scene),但 gather 与 display 输出形式不够统一。
obdiag check runsupports Table, JSON, YAML, and HTML reports
对数据库节点以只读诊断为主且 gather 收集日志支持脱敏,但 ~/.obdiag/config.yml 需配置 sys 租户密码与 SSH 凭证。
- Read-only cluster diagnostics with built-in log desensitization
基于 Python 构建,主要通过 OceanBase Yum/RPM 源或 obd cluster obdiag install 部署在 Linux 运维机上。
- Packaged for Linux RPM/OBD and Python environments
将跨多台 OBServer 节点的巡检(check)、收集(gather)、分析(analyze)、根因定位(rca)与实时看板(display)自动化。
- Covers
check,gather,analyze,rca, anddisplayacross cluster nodes
由 OceanBase 官方团队在 oceanbase/obdiag 仓库以 MulanPSL-2.0 协议持续维护。
- Official
oceanbase/obdiagrepo under MulanPSL-2.0
在 oceanbase.com 提供详尽的中文使用文档与子命令 --help,英文资料相对较少。
- Official OceanBase diagnostic docs and
--helpguides
安全边界、鉴权与放权指南
通过 obdiag config 将 OceanBase sys 租户凭证与节点 SSH 配置保存在 ~/.obdiag/config.yml 中。
开源免费(MulanPSL-2.0)。
# obdiag Agent Rules - Verify `~/.obdiag/config.yml` targets the intended cluster before running `obdiag check` or `gather`. - Use bounded `--since` / `--from` / `--to` windows when running `obdiag gather log` on large clusters. - Keep log desensitization enabled when sharing gathered diagnostic bundles externally.
Agent 高频安全命令配方
只读查询(安全推荐)
obdiag check list
展示所有支持集群与 OBProxy 健康检查的巡检包。
obdiag check run --report_type=json
检查内核参数、内部表与错误码状态并输出 JSON 格式诊断报告。
受控写入与预演
obdiag gather scene run --scene=observer.cpu_high
定向拉取诊断日志与状态包到本地归档目录,不修改数据库状态。
核心优势
- + 一条命令串联分布式 OceanBase 集群的
check、gather、analyze与rca。 - +
obdiag check run支持导出结构化 JSON 与 YAML 巡检报告。 - + 日志收集支持自动脱敏,降低排障压缩包外发泄密风险。
注意事项与踩坑点
- ! 主要面向 Linux RPM/OBD 运维环境分发,暂未提供 Homebrew 或 PyPI 一键安装。
- ! 官方文档与故障场景说明以中文为主。
已验证兼容的 Agent 宿主
Follow 家族生态联动
同分类相关 CLI: 数据库与数据处理
进入分类页 →Apache Spark 分布式 SQL CLI(`spark-sql`),通过 `-e` 与 `-f` 查询 Parquet、Iceberg 与 Delta Lake 表。
Node.js SQL 查询构建器的迁移与种子脚本 CLI(`knex migrate:status`、`migrate:latest`、`seed:run`)。