workbuddy.xpcool.com/.workbuddy/tmp/kuma-final-check.sh

20 lines
855 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 复核Bark 通知 + 各监控的证书到期通知开关
DB=/app/data/kuma.db
Q() { sudo docker exec uptime-kuma sqlite3 "$DB" "$1"; }
echo "=== 通知渠道 ==="
Q "SELECT id, name, active, is_default, json_extract(config,'\$.type') AS type, json_extract(config,'\$.barkEndpoint') AS endpoint, json_extract(config,'\$.barkGroup') AS grp FROM notification;"
echo ""
echo "=== 监控 × 证书到期通知开关 ==="
Q "SELECT id, name, expiry_notification, interval, maxretries FROM monitor ORDER BY id;"
echo ""
echo "=== 关联数 ==="
Q "SELECT COUNT(*) FROM monitor_notification;"
echo ""
echo "=== 当前各监控状态(最近一条心跳) ==="
Q "SELECT m.id, m.name, h.status, h.time FROM monitor m LEFT JOIN heartbeat h ON h.id = (SELECT id FROM heartbeat WHERE monitor_id = m.id ORDER BY id DESC LIMIT 1) ORDER BY m.id;"