名称: uptime-kuma
描述: 与 Uptime Kuma 监控服务器交互。用于检查监控器状态、添加/删除监控器、暂停/恢复检查、查看心跳历史。触发关键词:Uptime Kuma、服务器监控、在线率检查、服务健康监控。
通过封装 Socket.IO API 的 CLI 工具管理 Uptime Kuma 监控器。
需要安装 uptime-kuma-api Python 包:
pip install uptime-kuma-api
环境变量(在 shell 或 Clawdbot 配置中设置):
- UPTIME_KUMA_URL - 服务器地址(例如 http://localhost:3001)
- UPTIME_KUMA_USERNAME - 登录用户名
- UPTIME_KUMA_PASSWORD - 登录密码
脚本位置:scripts/kuma.py
# 整体状态概览
python scripts/kuma.py status
# 列出所有监控器
python scripts/kuma.py list
python scripts/kuma.py list --json
# 获取监控器详情
python scripts/kuma.py get <id>
# 添加监控器
python scripts/kuma.py add --name "我的网站" --type http --url https://example.com
python scripts/kuma.py add --name "服务器Ping" --type ping --hostname 192.168.1.1
python scripts/kuma.py add --name "SSH端口" --type port --hostname server.local --port 22
# 暂停/恢复监控器
python scripts/kuma.py pause <id>
python scripts/kuma.py resume <id>
# 删除监控器
python scripts/kuma.py delete <id>
# 查看心跳历史
python scripts/kuma.py heartbeats <id> --hours 24
# 列出通知渠道
python scripts/kuma.py notifications
http - HTTP/HTTPS 端点检查ping - ICMP Ping 检查port - TCP 端口检查keyword - HTTP + 关键词搜索dns - DNS 解析检查docker - Docker 容器检查push - 推送式(被动)监控mysql, postgres, mongodb, redis - 数据库检查mqtt - MQTT 代理检查group - 监控器分组检查故障服务:
python scripts/kuma.py status
python scripts/kuma.py list # 查找 🔴 标记项
添加30秒间隔的HTTP监控器:
python scripts/kuma.py add --name "API健康检查" --type http --url https://api.example.com/health --interval 30
维护模式(暂停所有监控):
for id in $(python scripts/kuma.py list --json | jq -r '.[].id'); do
python scripts/kuma.py pause $id
done