Run a read-only Dameng DM8 database inspection with 85 checks and produce an HTML report.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:Shiyuedong-Jade/DM-inspect
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
This plugin publishes its README in Chinese only.
达梦 DM8 数据库巡检插件。执行 85 项只读巡检,生成 HTML 报告。
目录
功能
- 85 项只读巡检项,覆盖实例与版本、表空间与数据文件、日志与归档、内存与缓冲池、SQL 性能、对象与统计信息、用户与安全、作业与备份
- 可选采集数据库服务器的操作系统指标:CPU / 内存 / 磁盘 IO、内核参数、达梦日志告警
- 支持单实例、共享存储集群(DMDSC)、数据守护主备
- 表空间使用率按阈值着色,Top 类巡检项的条数可调
- 输出 HTML 报告,同目录附一份内容相同的 JSON
- 所有巡检 SQL 均为查询语句,不修改数据库配置
环境要求
| 项 | 要求 |
|---|---|
| Node.js | ≥ 20 |
| Java | 8 及以上(JDK 或 JRE)。11+ 以源码方式运行桥接器;8 先用 javac 编译一次,结果缓存在工作目录 |
| 达梦 JDBC 驱动 | DmJdbcDriver8.jar,需自行提供,见安装第 2 步 |
| DeepSeek Harness | 0.1.x |
安装
1. 安装插件
dsh plugin --profile web add github:Shiyuedong-Jade/DM-inspect
从本地目录安装:
dsh plugin --profile web add file:/path/to/dsh-plugin-dm8-inspect
file: 安装时绝对路径不能含空格:dsh plugin 会转发给 pnpm,参数在空格处断开。
2. 放置达梦 JDBC 驱动
驱动 jar 是达梦的商业组件,不随插件分发。把达梦安装目录下的
dmdbms/drivers/jdbc/DmJdbcDriver8.jar 复制到工作目录的 drivers/ 下:
| 平台 | 路径 |
|---|---|
| Windows | %USERPROFILE%\.dsh\dm8-inspect\drivers\ |
| Linux | ~/.dsh/dm8-inspect/drivers/ |
插件加载时会自动建好工作目录(drivers/、java/、runtime/)。工作目录可用插件配置 home 修改,见配置。
3. 重启
首次安装后重启 dsh web,并刷新已打开的页面。
使用
在会话里调用 dm8_inspect。所有参数都可以不填,目标、账号、口令都能在设置卡片里预先填好。
每次调用 dm8_inspect 时会出现一张设置卡片,填好保存后说一句「巡检一下」即可。
工具返回分级结论(严重 / 警告 / 正常 / 提示 / 不适用 / 未取到)和报告路径。报告为 HTML,同目录另存一份内容相同的 JSON。
调用参数
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
targets |
array | 设置卡片中的目标 | [{host, port, user, label}]。1 个为单实例,2 个及以上为集群巡检 |
user |
string | SYSDBA |
数据库账号 |
port |
integer | 5236 |
数据库端口 |
driver |
string | jdbc |
jdbc 连真实库;demo 使用内置样例数据,不连库 |
topN |
integer | 10 |
Top 类巡检项条数,5~50 |
tsWarnPct |
integer | 80 |
表空间使用率告警阈值(%) |
tsCritPct |
integer | 90 |
表空间使用率严重阈值(%) |
slowSqlMs |
integer | 1000 |
慢 SQL 阈值(毫秒) |
queryTimeoutMs |
integer | 30000 |
单条 SQL 超时(毫秒) |
sshUser |
string | — | 数据库服务器 OS 采集账号,填写后才会执行 |
sshPassword |
string | — | 数据库服务器 OS 采集口令 |
outDir |
string | <会话工作目录>/dm8-inspect-reports |
报告目录 |
password |
string | — | 数据库口令。会写入会话日志,建议改用设置卡片或凭据库 |
取值优先级:本次调用参数 > 设置卡片 > 凭据库。
配置
设置卡片
| 字段 | 说明 |
|---|---|
| 目标 | 每行一个 host:port。1 个为单实例,2 个及以上为集群巡检 |
| 数据库账号 / 数据库口令 | 默认 SYSDBA |
| SSH 账号 / SSH 口令 | 填写后才会执行数据库服务器 OS 级检查 |
| Top N | Top 类巡检项条数 |
| 慢 SQL 阈值 / 单条 SQL 超时 | 毫秒 |
| 表空间告警阈值 / 表空间严重阈值 | 百分比 |
| 报告目录 | 可选 |
卡片中的值按会话隔离,保存在 dsh 进程内存中,重启 dsh 后需要重新填写。
口令的另外两种来源
环境变量(启动 dsh 前设置):
export DM8_INSPECT_PASSWORD='数据库口令'
export DM8_INSPECT_SSH_PASSWORD='SSH口令'
或写入 ~/.dsh/.credentials.yaml 的 refs,键名同上。
插件配置
写在 profile 的 cordis.patch.yml 中该插件那一行上,也可以在设置界面里修改:
- insert:
- id: dm8-inspect
name: 'dsh-plugin-dm8-inspect'
config:
home: 'D:\dm8-inspect-home' # 工作目录,默认 ~/.dsh/dm8-inspect
driver: 'jdbc'
credentialRef: 'DM8_INSPECT_PASSWORD'
sshCredentialRef: 'DM8_INSPECT_SSH_PASSWORD'
outDir: '' # 默认 <会话工作目录>/dm8-inspect-reports
topN: 10
tsWarnPct: 80
tsCritPct: 90
slowSqlMs: 1000
queryTimeoutMs: 30000
connectTimeoutMs: 20000
clusterConcurrency: 3 # 集群巡检的节点并发数
| 配置项 | 默认值 | 说明 |
|---|---|---|
home |
~/.dsh/dm8-inspect |
工作目录,其下有 drivers/、java/、runtime/ |
driver |
jdbc |
默认巡检驱动 |
credentialRef |
DM8_INSPECT_PASSWORD |
数据库口令的凭据名 |
sshCredentialRef |
DM8_INSPECT_SSH_PASSWORD |
SSH 口令的凭据名 |
outDir |
空 | 报告目录,留空则使用会话工作目录下的 dm8-inspect-reports |
topN |
10 |
Top 类巡检项条数 |
tsWarnPct / tsCritPct |
80 / 90 |
表空间使用率阈值(%) |
slowSqlMs |
1000 |
慢 SQL 阈值(毫秒) |
queryTimeoutMs |
30000 |
单条 SQL 超时(毫秒) |
connectTimeoutMs |
20000 |
连接超时(毫秒) |
clusterConcurrency |
3 |
集群巡检的节点并发数,上限 8 |
注意事项
- 所有巡检 SQL 都是查询语句,不修改数据库任何配置。
- 连接失败时不生成报告文件,只返回失败原因。
- 单实例环境下「不适用」最少 11 项,这些是共享存储集群与数据守护专项。要覆盖全部 85 项,还需在卡片中填写 SSH 账号。
- OS 级检查依赖 SSH。未填 SSH 账号时,主机 CPU / 内存 / IO、内核参数、日志扫描等项判为「不适用」。
- 报告默认输出到会话工作目录,而不是 dsh 进程的启动目录。
- 数据守护(主备)形态尚未在真机验证:
dw.*那 5 个巡检项使用相同的视图,但结论文案与形态判定没有实测。 - 以下环境未验证:DM9、Windows 上的达梦、ARM 架构(鲲鹏 / 飞腾)、启用归档的库。
- 工作目录会保留编译缓存。Java 8 下首次运行会编译桥接器,产物在
home/runtime/classes;删除home/runtime/可清空,下次运行自动重建。 - 报告文件名带时间戳,同一目录下多次巡检不会互相覆盖。
卸载
dsh plugin --profile web remove dsh-plugin-dm8-inspect
再删除工作目录(其中包含驱动 jar):
| 平台 | 命令 |
|---|---|
| Windows | Remove-Item "$env:USERPROFILE\.dsh\dm8-inspect" -Recurse -Force |
| Linux | rm -rf ~/.dsh/dm8-inspect |
目录结构
├── package.json 插件清单
├── cordis.patch.yml 作为 bundle 的插入清单
├── lib/
│ ├── index.js 插件入口:注册工具与会话设置路由
│ ├── tool.js dm8_inspect 工具定义
│ ├── session-form.js 设置卡片的进程内暂存
│ ├── engine.js 加载 engine/ 下的巡检引擎
│ └── workspace.js 工作目录准备
├── client/
│ └── client.js 设置卡片的客户端部分
├── engine/ 巡检引擎:巡检项定义、执行器、报告生成
├── assets/java/
│ └── DmBridge.java JDBC 桥接器源码
└── tools/ 开发与自检脚本
开发
node tools/package-check.mjs # 清单与文档中的声明是否与代码一致
node tools/smoke.mjs # 用内置样例数据跑完整链路
node tools/session-form-check.mjs # 设置卡片:字段、取值优先级、渲染
node tools/apply-check.mjs # 插件注册与路由
node tools/verify-install.mjs # 安装结果能否被加载,--profile 指定 profile
node tools/live.mjs # 连真实库巡检一次,需 DM8_TEST_HOST、DM8_TEST_DB_PW 等环境变量
node tools/install.mjs # 手动安装或卸载,支持 --dry-run、--uninstall
部署与重载:改完代码为什么不生效
宿主加载的不是本仓库,而是 profile 目录下的安装副本:
$DSH_HOME/profiles/web/node_modules/dsh-plugin-dm8-inspect
本仓库(D:\dsh-plugins\dsh-plugin-dm8-inspect)里改了不会自动生效。当前 profile 走的是标准安装路线,在 profiles/web/package.json 里声明成 git 依赖:
"dsh-plugin-dm8-inspect": "github:Shiyuedong-Jade/DM-inspect"
pnpm-lock.yaml 还会把当时解析到的提交号钉死在其中。所以从「改完本仓库」到「宿主跑起来」要两步,缺一步都不生效:
推到 GitHub,再更新安装副本:
dsh plugin --profile web update dsh-plugin-dm8-inspect重启宿主进程(
dsh web)。
第 2 步不能省。profile 虽然声明了 patchReload: live,但 live 覆盖的只有补丁文件(profiles/web/cordis.patch.yml 与 home 级 patch),插件代码没有热重载通道。三条原因各自独立:该分支装载的 @deepseek-ai/cordis-plugin-hmr 配置是 { root: [] },其源码里 root.length === 0 直接判为 resolved,一个目录都不监视;改补丁文件触发的 recompose 按 entry 做 diff,entry 没变就不会重新 import;profiles/web/pnpm-workspace.yaml 里是 nodeLinker: hoisted,插件装在固定路径的普通目录里,更新后路径不变,而 Node 的 ESM 模块表按 URL 永久缓存,同一 URL 只会拿回旧模块。
客户端部分(client/client.js)同理:更新副本并重启之后,浏览器页面还需要刷新一次。
判断是否真的生效要看行为:传一个「改了才会成立」的输入,观察结论有没有变。tools/verify-install.mjs 回答的是另一个问题(安装位置能否被加载),它不比较新旧。
许可证
Links
More in this category
Tencent/WeKnora#dsh-weknora★ 38318
Four read-only tools over a WeKnora knowledge base: list knowledge bases, hybrid passage search, reassemble one document's chunks in order, and WeKnora's own cited RAG or ReAct-agent answer with a resumable session id.
DayuanJiang/next-ai-draw-io#dsh-plugin★ 37203
Draws draw.io diagrams in DeepSeek Harness through the next-ai-drawio MCP server: the link in the reply opens a live preview in the right sidebar, you can edit the diagram by hand, and each AI change is a version you can restore. Node.js 18+; npx downloads the MCP server on first use.
yikart/AiToEarn#dsh-plugin-aitoearn★ 28763
Generate copy, images and short videos, and publish with one click to Douyin, Kuaishou, Xiaohongshu, WeChat Official, Bilibili, Facebook, TikTok and more, covering the full content lifecycle from creation to publishing and monetization.
superdesigndev/treg★ 9619
Tool catalog for agents: search ~2,600 external endpoints (SEO and SERP, backlinks, social, people and company enrichment, ad libraries, scraping) by the task you want done, read each one's parameters and per-call price, then call it with the credential injected server-side. Ships the skill plus an MCP row that stays disabled until TREG_TOKEN is set.
T-Auto/dsh-ops★ 6028
Provides bash, PowerShell 7, and high-performance Rust tools for DSH on Windows to reduce token usage.
Hithink-Tech-Org/Financial-API#hithink-finance★ 4641
Query Hithink Finance data in DeepSeek Harness, view charts in chat, and save refreshable dashboards.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.