首页龙虾技能列表 › SSH Server Watchdog — SSH服务器监控

SSH Server Watchdog — SSH服务器监控

v1.0.0

通过SSH监控远程服务器 — 检查服务健康状态(PM2、systemd、Docker)、数据库状态(MongoDB、MySQL、PostgreSQL)、磁盘空间、内存,并自动重启崩溃的服务,通过消息发送告警。

0· 73·0 当前·0 累计
by @qoohsuan (Qoohsuan)·MIT-0
下载技能包
License
MIT-0
最后更新
2026/3/26
安全扫描
VirusTotal
可疑
查看报告
OpenClaw
可疑
high confidence
该技能声称提供广泛的SSH监控服务,但实际上包含一个专注于Windows/MongoDB的监控程序,存在未声明的凭证需求和不安全的使用模式(密码明文expect、硬编码路径/主机),因此其需求和说明与描述不符。
评估建议
此技能存在可疑之处,因为它声称提供广泛的SSH/服务器监控,但实际只提供了一个针对Windows的MongoDB监控程序,包含硬编码路径、内部主机提及(10.0.0.213)和未声明的环境变量/凭证需求。安装前请注意:1)生产环境中不要使用密码expect方式——会暴露明文密码;优先使用基于密钥的SSH,避免在命令中嵌入密码。2)本地检查并(最好)修改脚本:移除硬编码的IP地址、默认聊天ID和Windows特定路径;明确安全地设置TELEGRAM_BOT_TOKEN/TELEGRAM_CHAT_ID。3)首先在隔离环境(非生产VM)中测试,验证行为和重启逻辑;限制自动重启频率以避免重启循环。4)谨慎授予监控程序可重启服务的账户——优先使用专用的低权限服务账户。5)如果您只需要通用的PM2/systemd/Docker/MySQL/Postgres监控,该软件包开箱即用不提供这些;请将其视为MongoDB/Windows工具,仅在审计并适配代码后安装。如果您无法自行审计代码,请勿部署到生产环境。...
详细分析 ▾
用途与能力
清单和SKILL.md宣传通用SSH监控(PM2、systemd、Docker、MySQL、PostgreSQL、MongoDB),但包含的代码是一个针对Windows的MongoDB专注Node.js监控程序(硬编码Windows路径、D:\日志、'net start/stop'),甚至包含特定内部主机(10.0.0.213)和SSH管理字符串的注释。实现范围远比描述的更为狭窄且环境特定。
指令范围
运行时指令告诉agent运行SSH命令并可选地使用明文密码的expect(示例expect代码片段)。SKILL.md指示将包含的JS文件复制到远程服务器并运行npm install和pm2——这是一致的——但它也省略了声明脚本读取的环境变量(TELEGRAM_BOT_TOKEN、TELEGRAM_CHAT_ID)。expect的使用和示例鼓励处理明文密码和在命令中暴露凭证。
安装机制
注册表中没有安装规范(仅指令),但SKILL.md指示用户在目标上npm install mongodb npm包。这是一个标准的、可追踪的安装机制(npm)——没有任意URL下载——但它确实会在目标服务器上写入文件并安装由PM2管理的持久进程。
凭证需求
该技能未声明所需的环境变量,但包含的脚本从环境读取TELEGRAM_BOT_TOKEN和TELEGRAM_CHAT_ID,并使用本地文件系统路径(C:\ProgramData...、D:\ProPower_System...)和硬编码的默认chatId。SKILL.md还需要本地'expect'用于密码SSH,但未声明。这些未声明的凭证/二进制需求和硬编码的内部主机/路径值与通用监控技能不符。
持久化与权限
该技能指示部署持久PM2进程(pm2 start ...; pm2 save)。这对于看门狗是预期的,注册表标志不强制always:true。然而,持久进程将以用户在目标服务器上授予的任何权限运行(它执行服务重启命令),因此权限和影响范围取决于安装方式和使用的账户。
scripts/mongodb-watchdog.js:89
检测到Shell命令执行(child_process)。
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv1.0.02026/3/26

初始版本:基于SSH的服务器监控,支持PM2、MongoDB、磁盘和内存检查,自动重启服务

● 可疑

安装命令 点击复制

官方npx clawhub@latest install ssh-server-watchdog
镜像加速npx clawhub@latest install ssh-server-watchdog --registry https://cn.clawhub-mirror.com

技能文档

通过SSH监控和自动修复远程服务器。检查服务、数据库、磁盘、内存——重启宕机的服务,告警异常情况。

Prerequisites

  • SSH access to target server (password or key-based)
  • expect available locally (for password-based SSH)
  • Target server runs PM2, systemd, or Docker for service management

Quick Reference

Check PM2 services

ssh user@host "pm2 list"
ssh user@host "pm2 logs --lines 20 --nostream"

Check MongoDB

# Windows
ssh user@host "net start | findstr MongoDB"
ssh user@host "powershell -Command \"(Test-NetConnection -ComputerName 127.0.0.1 -Port 27017).TcpTestSucceeded\""

# Linux ssh user@host "systemctl status mongod" ssh user@host "mongosh --eval 'db.runCommand({ping:1})' --quiet"

Check disk & memory

# Linux
ssh user@host "df -h && free -h"

# Windows ssh user@host "powershell -Command \"Get-PSDrive -PSProvider FileSystem | Select Root,Used,Free; \$os=Get-CimInstance Win32_OperatingSystem; Write-Output ('RAM: '+[math]::Round((\$os.TotalVisibleMemorySize-\$os.FreePhysicalMemory)/1MB,1)+'GB / '+[math]::Round(\$os.TotalVisibleMemorySize/1MB,1)+'GB')\""

Workflow

  • Diagnose — SSH in, check service status, logs, disk, memory
  • Identify — Parse logs for errors, crashes, OOM, or unclean shutdowns
  • Fix — Restart crashed services (pm2 restart, net start, systemctl restart)
  • Verify — Confirm service is back up and responding
  • Alert — Notify user via messaging with summary

Crash Analysis

When a service is down, check these in order:

  • Service logspm2 logs, journalctl -u service, Windows Event Log
  • Application logs — Check log files at configured paths
  • System events — OOM killer, unexpected shutdowns, disk full
  • Database logs — MongoDB: check mongod.log for Fatal ("s":"F") entries

MongoDB crash patterns

"s":"F" — Fatal error (crash)
"Unhandled exception" — Internal bug (often FTDC related)
"Detected unclean shutdown" — Process killed without graceful shutdown
"WiredTiger error" — Storage engine corruption

Auto-Heal Recipes

PM2 service restart

pm2 restart 
pm2 save # persist across reboots

MongoDB (Windows)

net stop MongoDB
timeout /t 5
net start MongoDB

MongoDB (Linux)

sudo systemctl restart mongod

Deploy watchdog service

For persistent monitoring, deploy the included watchdog script:

  • Copy scripts/mongodb-watchdog.js to target server
  • Install: npm init -y && npm install mongodb
  • Start: pm2 start mongodb-watchdog.js --name mongodb-watchdog
  • Save: pm2 save

SSH with password (via expect)

When key-based auth isn't available:

expect -c 'set timeout 20 spawn ssh -o StrictHostKeyChecking=no user@host "COMMAND" expect { "password:" { send "PASSWORD\r"; exp_continue } eof } '

Alert Template

🚨 Server Alert — [hostname]
⏰ Time: [timestamp]
❌ Issue: [service] is DOWN
📋 Cause: [crash reason from logs]
🔄 Action: Auto-restarted [service]
✅ Status: [service] is back online
📊 System Health:
• Memory: X GB / Y GB
• Disk: Z% used
• Services: N/N online
数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务