Capture Neko/WG/network hubs, Studio viewer charts, physical deploy docs, and one-shot scripts so VPS vs physical can be toggled later without losing WIP. Co-authored-by: Cursor <cursoragent@cursor.com>
54 lines
2.3 KiB
Python
54 lines
2.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
import sys, paramiko, time
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
# Jump via VPS then try localhost tunnels, or direct to mapped ports from internet
|
|
# pve-nomadro.cn: 107.173.30.245:4014 -> client 127.0.0.1:22 (nomadro machine)
|
|
# loading ones aren't listening so can't use them
|
|
|
|
def try_ssh(host, port, user, password, cmd, label):
|
|
print(f'\n===== {label} {host}:{port} =====')
|
|
c=paramiko.SSHClient(); c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
try:
|
|
c.connect(host, port, user, password, timeout=20, allow_agent=False, look_for_keys=False, banner_timeout=20)
|
|
except Exception as e:
|
|
print('CONNECT FAIL', type(e).__name__, e)
|
|
return
|
|
_,o,e=c.exec_command(cmd, timeout=60)
|
|
print(o.read().decode('utf-8','replace')[-8000:])
|
|
err=e.read().decode('utf-8','replace')
|
|
if err.strip(): print('STDERR', err[-500:])
|
|
c.close()
|
|
|
|
CMD=r'''
|
|
set +e
|
|
hostname; uptime; free -h | head -2
|
|
echo '--- frp clients ---'
|
|
ps aux | grep -iE 'frp|frpp' | grep -v grep
|
|
systemctl list-units --type=service --all 2>/dev/null | grep -iE 'frp|panel' || true
|
|
ls /etc/systemd/system/*frp* 2>/dev/null
|
|
echo '--- frpp status ---'
|
|
systemctl status frpp --no-pager -l 2>/dev/null | head -35
|
|
journalctl -u frpp --no-pager -n 40 2>/dev/null | tail -40
|
|
echo '--- docker frp ---'
|
|
docker ps -a 2>/dev/null | grep -i frp
|
|
'''
|
|
|
|
# Direct public mappings
|
|
try_ssh('107.173.30.245', 4014, 'root', 'Xiao4669805', CMD, 'via pve-nomadro.cn')
|
|
|
|
# Also check Master DB lock recovery: checkpoint + count locked errors
|
|
print('\n===== MASTER db checkpoint attempt (read-only check first) =====')
|
|
m=paramiko.SSHClient(); m.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
m.connect('107.172.77.34',22,'root','Xiao4669805',timeout=45,allow_agent=False,look_for_keys=False)
|
|
_,o,_=m.exec_command(r'''
|
|
docker logs --since 24h frp-panel 2>&1 | grep -c 'database is locked' || true
|
|
# inspect how master container started
|
|
docker inspect frp-panel --format '{{.HostConfig.Binds}} {{.Config.Cmd}} {{.Config.Entrypoint}}'
|
|
docker inspect frp-panel --format '{{json .HostConfig.RestartPolicy}} Image={{.Config.Image}}'
|
|
# show docker run-like
|
|
docker inspect frp-panel --format '{{range .Config.Env}}{{println .}}{{end}}'
|
|
''', timeout=60)
|
|
print(o.read().decode('utf-8','replace'))
|
|
m.close()
|