npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ops-monitor

v1.1.1

Published

运维监控面板 - 支持 SNMP/IPMI/SSH/HTTP 四协议,实时仪表盘 + 告警 + SLA 报表

Downloads

48

Readme

🖥️ 运维监控面板

React + ECharts 前端,Node.js + Express 后端。支持 SNMP / IPMI / SSH / HTTP 四种协议主动采集,以及 ops-monitor-agent 轻量代理被动接收两种监控模式。

功能清单

| 功能 | 说明 | |------|------| | 多协议采集 | SNMP / IPMI / SSH / HTTP 主动拉取 | | Agent 代理 | 配合 ops-monitor-agent 接收被监控端主动上报 | | 设备管理 | 增删改查、分组、批量导入 | | 指标采集 | CPU / 内存 / 磁盘 / 网络 / 进程 / 温度 | | 可视化仪表盘 | ECharts gauge 仪表盘 + bar 柱状对比 + line 趋势折线 | | 实时更新 | WebSocket 推送,15秒心跳保活 | | 阈值告警 | warn / critical 两级阈值,支持告警升级 | | 告警去重 / 静默 | 5分钟去重窗口 + 按时间段静默 | | 指标持久化 | SQLite 存储,重启不丢数据 | | SLA 报表 | 可用性热力图 + uptime 百分比 + CSV 导出 | | 暗色主题 | 经典监控黑色主题 | | 大屏模式 | 全屏轮播展示,适配挂墙电视 | | 自定义布局 | 拖拽排列仪表盘卡片 | | 配置热更新 | 改 config.json 后不用重启 | | 数据自动清理 | 每天凌晨 3 点自动清理 30 天前数据 |

快速开始

方式一:npm 安装(推荐)

# 安装监控中心
npm install -g ops-monitor

# 初始化配置
ops-monitor init

# 启动
ops-monitor start

打开 http://localhost:3001

方式二:源码运行

cd server && npm install
cd ../client && npm install

cd ../server
cp config.example.json config.json
# 编辑 config.json 添加设备

# 终端 1: npm run dev  (后端 3001)
# 终端 2: npm run dev  (前端 5173)

Agent 代理模式

除了通过 SNMP/SSH 等协议主动采集,还支持 Agent 代理模式:在被监控设备上安装轻量代理,主动上报指标到中心。

优势

  • 不需要在被监控机器上开放 SNMP/SSH 端口
  • 不需要配置复杂的采集协议
  • 装上就能用,自动重连
  • 采集 CPU / 内存 / 磁盘 / 网络 / 进程 / 负载

部署步骤

# 1. 监控中心(确保 v1.1.0+)
npm install -g ops-monitor
ops-monitor start

# 2. 被监控设备上安装 agent
npm install -g ops-monitor-agent

# 3. 初始化配置
ops-monitor-agent init

# 4. 编辑配置,填入监控中心地址
vim ops-monitor-agent.json
{
  "server": "http://监控中心IP:3001",
  "secret": "",
  "deviceId": "my-server",
  "interval": 10,
  "tags": ["production"]
}
# 5. 启动 agent
ops-monitor-agent

Agent 启动后会自动连接监控中心,指标出现在 Web 面板上。

Agent 常驻运行

systemd (Linux):

sudo tee /etc/systemd/system/ops-monitor-agent.service << EOF
[Unit]
Description=ops-monitor Agent
After=network.target

[Service]
Type=simple
ExecStart=$(which ops-monitor-agent)
WorkingDirectory=/etc/ops-monitor-agent
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable --now ops-monitor-agent

launchd (macOS):

cat > ~/Library/LaunchAgents/com.ops-monitor.agent.plist << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.ops-monitor.agent</string>
    <key>ProgramArguments</key>
    <array><string>/usr/local/bin/ops-monitor-agent</string></array>
    <key>WorkingDirectory</key>
    <string>/etc/ops-monitor-agent</string>
    <key>RunAtLoad</key><true/>
    <key>KeepAlive</key><true/>
</dict>
</plist>
EOF

launchctl load ~/Library/LaunchAgents/com.ops-monitor.agent.plist

Agent API

| 方法 | 路径 | 说明 | |------|------|------| | GET | /api/agents | Agent 列表 | | GET | /api/agents/stats | Agent 在线/离线统计 | | GET | /api/agents/:id | Agent 详情 | | POST | /api/agents/:id/collect | 要求立即采集 | | POST | /api/agents/:id/interval | 修改上报间隔 | | GET | /api/agents/:id/metrics | Agent 历史指标 |

项目结构

ops-monitor/
├── server/
│   ├── config.example.json
│   └── src/
│       ├── index.js               # 入口 + Express + WebSocket
│       ├── storage.js             # SQLite 持久化
│       ├── poller.js              # 轮询调度
│       ├── collectors/            # SNMP/IPMI/SSH/HTTP 采集器
│       ├── agents/
│       │   └── registry.js        # Agent 连接管理
│       ├── devices/
│       │   └── manager.js         # 设备管理
│       ├── alerts/
│       │   └── engine.js          # 告警引擎
│       └── routes/
│           └── api.js             # REST API
├── client/                        # React + ECharts 前端

API 接口

| 方法 | 路径 | 说明 | |------|------|------| | GET | /api/devices | 设备列表 | | POST | /api/devices | 添加设备 | | GET/PUT/DELETE | /api/devices/:id | 单设备操作 | | GET | /api/devices/:id/metrics | 最新指标 | | GET | /api/devices/:id/history | 指标历史 | | POST | /api/devices/:id/collect | 手动采集 | | GET | /api/snapshot | 全设备快照 | | GET | /api/alerts/active | 活跃告警 | | GET/POST | /api/silences | 静默规则 | | GET | /api/devices/:id/sla | 设备 SLA | | GET | /api/reports/sla-summary | SLA 汇总报表 | | GET | /api/health | 健康检查 |

配置说明

{
  "alerting": {
    "checkInterval": 30000,
    "dedupWindow": 300000,
    "escalateTimeout": 600000
  },
  "agent": {
    "secret": ""
  }
}

相关项目

License

MIT