AKS1st/dsh-sysmon
DSH Web系统状态悬浮窗:实时显示CPU、内存和磁盘占用率 | 针对DSH Web的系统状态悬浮窗,展示实时CPU、内存及磁盘使用情况
项目介绍Project Overview
dsh-sysmon 是 DSH Web 的系统状态悬浮窗插件,固定在页面右下角,每 1 秒刷新显示 CPU、内存、磁盘占用率,并通过阈值切换浅灰、橙、红三色字样;CPU 按核心数比例计算,内存与磁盘以 80%、90% 为分界。它适合需要随时观察主机负载而又不想被界面元素干扰的用户。注意:该插件仅支持 Linux 平台,仅报告根文件系统磁盘占用,CPU 数值为约 1 秒采样窗口的平均值。
dsh-sysmon is a DSH Web plugin that renders a fixed overlay in the bottom-right corner, refreshing every second to show CPU, memory, and disk usage with text that shifts from gray to orange to red as thresholds are crossed. CPU is measured against core count, while memory and disk use 80% and 90% cutoffs. It suits users who want unobtrusive, real-time visibility of host load. Note: Linux only, disk usage is reported only for the root filesystem, and the CPU percentage is a 1-second sample-window average.
请帮我了解并安装插件:【dsh-sysmon】【https://github.com/AKS1st/dsh-sysmon】
把上面这条消息直接发给当前会话里的 DSH,让它帮你了解并安装。安装命令不一定准确,发给 DSH 更稳。Send this message to DSH in your current session. CLI install commands may not be accurate across systems — DSH will figure it out for you.
或使用命令行安装(适合开发者)Or use CLI install (for developers)
命令行安装CLI Install
dsh plugin --profile web add github:AKS1st/dsh-sysmon
把 AKS1st/dsh-sysmon 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-sysmon
DSH Web 的系统状态悬浮窗:固定在页面右下角,每 1 秒刷新显示 CPU、内存、磁盘占用率。
CPU 39%/16 MEM 46% DISK 22%
显示规格
- 位置:右下角固定悬浮,
pointer-events: none,不遮挡界面操作。 - 配色:默认浅灰色小字(等宽字体、11px)。
- 刷新:1 秒一次。
阈值规则
| 指标 | 默认(浅灰) | 橙色 | 红色 |
|---|---|---|---|
| CPU(x%/y) | < 90%×核心数 | x ≥ 90%×核心数 | x ≥ 98%×核心数 |
| 内存 | ≤ 80% | > 80% | > 90% |
| 磁盘 | ≤ 80% | > 80% | > 90% |
- CPU:
x%为所有核心使用率之和(可超过 100%),y为总核心数;阈值按总容量比例计算。 - 内存 / 磁盘:超过 80% 橙色、超过 90% 红色。
安装
从 GitHub 仓库安装:
dsh plugin --profile web add github:AKS1st/dsh-sysmon
dsh web
或 clone 到本地后从本地目录安装:
git clone https://github.com/AKS1st/dsh-sysmon.git
cd dsh-sysmon
npm install
npm run build
dsh plugin --profile web add .
dsh web
工作方式
- Host(
src/index.ts):ctx.effect挂一个每秒运行的后台采样器,经ctx.shell采样(/proc/stat、nproc、/proc/meminfo、df -P /),把最新快照写入内存缓存。路由GET /dsh-sysmon/api只返回缓存(亚毫秒、零子进程开销),并拒绝非 GET 方法与跨源浏览器请求。CPU 使用率为相邻两次采样之间的增量(窗口约 1 秒),首次采样显示 0。 - Client(
src/client/index.ts):创建#dsh-sysmon固定定位元素,每 1 秒fetch一次路由,带 in-flight 守卫避免请求重叠;重绘只更新三个数值节点(diff 式)。纯 DOM 实现、零运行时依赖。
已知限制
- 仅 Linux——宿主采集器读取
/proc/stat、/proc/meminfo与df;其他平台需要不同的采集器。 - 仅根文件系统——磁盘占用只报告
/,按挂载点选择暂缓。 - 采样窗口近似——CPU 百分比是相邻两次采样(约 1 秒)间隔内忙时占比,窗口内瞬时突发被平均。
ruvnet/ruflo
amruthpillai/reactive-resume
volcengine/OpenViking
Molunerfinn/PicGo
titanwings/colleague-skill
nocobase/nocobase
Tencent/WeKnora