mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 17:10:43 +00:00
36 lines
1.3 KiB
Bash
36 lines
1.3 KiB
Bash
#!/bin/bash
|
|
# 看设备上隧道现在的配比 + 连接数(判断 relay-stability 有没有在跑对照)
|
|
set -u
|
|
|
|
echo " ── 两个隧道单元的配置 ──"
|
|
for s in lanremote-tunnel lanremote-tunnel-h2; do
|
|
if [ -f "/etc/systemd/system/$s.service" ]; then
|
|
cfg=$(grep -oE -- '--protocol [a-z0-9]+|--ha-connections [0-9]+|--metrics [0-9.:]+' \
|
|
"/etc/systemd/system/$s.service" | tr '\n' ' ')
|
|
printf " %-24s %s (%s)\n" "$s" "$cfg" "$(systemctl is-active $s 2>/dev/null)"
|
|
else
|
|
printf " %-24s (不存在)\n" "$s"
|
|
fi
|
|
done
|
|
|
|
echo
|
|
echo " ── 实时连接数 ──"
|
|
for p in 20241 20242; do
|
|
n=$(curl -s --max-time 4 "http://127.0.0.1:$p/metrics" 2>/dev/null \
|
|
| grep '^cloudflared_tunnel_ha_connections' | awk '{print $2}')
|
|
printf " 端口 %s -> %s 条\n" "$p" "${n:-读不到}"
|
|
done
|
|
|
|
echo
|
|
echo " ── 公网自检 ──"
|
|
curl -s --max-time 20 -o /dev/null -w ' HTTP %{http_code} %{time_total}s\n' \
|
|
-H 'User-Agent: LanRemote/1.8.2' https://relay.xxmxxs.top/v1/health
|
|
|
|
echo
|
|
echo " ── relay-stability 的测量进程 ──"
|
|
pgrep -af 'rp_|longstab|bench' 2>/dev/null | head -5 | sed 's/^/ /' || echo " (没有在跑)"
|
|
|
|
echo
|
|
echo " ── 它最近写的文件 ──"
|
|
ls -la --time-style=+%H:%M:%S /root/rp_* /root/*.tsv 2>/dev/null | tail -8 | sed 's/^/ /' || true
|