workbuddy.xpcool.com/.workbuddy/tmp/kuma-bark-inspect.sh

38 lines
1.6 KiB
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
# 1) 确认 Bark key 可用(发一条真实测试推送) 2) 取 Kuma Bark 通知配置字段 3) 查容器网络(决定用哪个地址访问 Bark
# 2026-09-13
KEY="sm5WnyANWx89GgLtFnRXhk"
echo "=== 1. Bark 服务自检 ==="
curl -s -o /dev/null -m 10 -w "healthz=%{http_code}\n" http://127.0.0.1:8081/healthz
echo ""
echo "=== 2. 发送真实测试推送(宿主机 → Bark ==="
curl -s -m 20 -o /tmp/bark-test.json -w "http=%{http_code}\n" \
"http://127.0.0.1:8081/$KEY/Kuma%20Test/ai-verify-20260913"
echo "--- resp ---"
cat /tmp/bark-test.json 2>/dev/null
echo ""
echo ""
echo "=== 3. Kuma 容器网络 ==="
sudo docker inspect uptime-kuma --format '{{json .NetworkSettings.Networks}}'
echo ""
echo "--- 容器内能否访问宿主机 Bark (172.17.0.1) ---"
sudo docker exec uptime-kuma sh -c "curl -s -o /dev/null -m 8 -w 'code=%{http_code}\n' http://172.17.0.1:8081/healthz" 2>&1 || echo "container curl 不可用"
echo ""
echo "=== 4. Bark 通知 provider 源码(取字段名) ==="
sudo docker exec uptime-kuma cat /app/server/notification-providers/bark.js 2>&1 | head -60
echo ""
echo "=== 5. Kuma 表结构 ==="
sudo docker exec uptime-kuma sqlite3 /app/data/kuma.db "PRAGMA table_info(notification);" 2>&1
echo "--- monitor_notification ---"
sudo docker exec uptime-kuma sqlite3 /app/data/kuma.db "PRAGMA table_info(monitor_notification);" 2>&1
echo "--- 现有通知 ---"
sudo docker exec uptime-kuma sqlite3 /app/data/kuma.db "SELECT id,name,active,user_id,is_default FROM notification;" 2>&1
echo "--- 现有监控 ---"
sudo docker exec uptime-kuma sqlite3 /app/data/kuma.db "SELECT id,name FROM monitor ORDER BY id;" 2>&1