81 lines
2.5 KiB
Python
81 lines
2.5 KiB
Python
#!/usr/bin/env python3
|
|
"""Diagnose dylive neko/12 Chrome SIGILL Aw Snap; soft-recover Studio tab."""
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
HOST = "107.173.30.245"
|
|
PASS = "Xiao4669805"
|
|
|
|
|
|
def ssh():
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(
|
|
HOST,
|
|
22,
|
|
"root",
|
|
PASS,
|
|
timeout=45,
|
|
allow_agent=False,
|
|
look_for_keys=False,
|
|
banner_timeout=120,
|
|
)
|
|
return c
|
|
|
|
|
|
def run(c, cmd, t=120):
|
|
print(f"\n===== {cmd[:100].replace(chr(10),' ')} =====", flush=True)
|
|
_i, o, e = c.exec_command(cmd, timeout=t)
|
|
out = (o.read() + e.read()).decode("utf-8", "replace")
|
|
print(out[-14000:] if len(out) > 14000 else out, flush=True)
|
|
return o.channel.recv_exit_status(), out
|
|
|
|
|
|
c = ssh()
|
|
|
|
run(
|
|
c,
|
|
r"""
|
|
set +e
|
|
echo '=== host mem/cpu ==='
|
|
free -h | head -4
|
|
nproc
|
|
lscpu | egrep 'Model name|Flags|Architecture|CPU\(s\)|Vendor' | head -20
|
|
grep -E 'avx|sse4|avx2|amx' /proc/cpuinfo | head -1 | tr ' ' '\n' | grep -E '^(avx|avx2|sse4|ssse3|amx)' | sort -u
|
|
echo '=== neko12 container ==='
|
|
docker ps -a --filter name=douyinweb-neko-12 --format '{{.Names}} {{.Status}} {{.Image}}'
|
|
docker inspect douyinweb-neko-12 --format 'MemLimit={{.HostConfig.Memory}} NanoCPUs={{.HostConfig.NanoCpus}} OomKillDisable={{.HostConfig.OomKillDisable}}'
|
|
echo '=== dmesg recent kill/ill ==='
|
|
dmesg -T 2>/dev/null | grep -iE 'neko-12|chrome|SIGILL|Out of memory|oom-kill|killed process' | tail -30
|
|
journalctl -k -n 80 --no-pager 2>/dev/null | grep -iE 'oom|chrome|SIGILL|neko' | tail -20
|
|
echo '=== inside neko12 ==='
|
|
docker exec douyinweb-neko-12 sh -c '
|
|
set +e
|
|
echo CPU_IN_CTR:
|
|
grep -m1 flags /proc/cpuinfo | tr " " "\n" | grep -E "^(avx|avx2|sse4_2|ssse3)$" | sort -u
|
|
echo MEM:
|
|
free -h 2>/dev/null | head -3 || cat /proc/meminfo | head -5
|
|
echo CHROME:
|
|
ps aux 2>/dev/null | grep -E "chrome|chromium" | grep -v grep | head -15
|
|
echo FLAGS:
|
|
tr "\0" " " < /proc/$(pgrep -f "google-chrome.*remote-debugging" | head -1)/cmdline 2>/dev/null | head -c 800; echo
|
|
echo CRASHES:
|
|
ls -lt /home/neko/.config/google-chrome/Crash\ Reports/pending 2>/dev/null | head -5
|
|
ls -lt /home/neko/.config/google-chrome/Crashpad/completed 2>/dev/null | head -5
|
|
echo SUPERVISOR:
|
|
supervisorctl status 2>/dev/null || true
|
|
'
|
|
echo '=== other nekos health ==='
|
|
docker ps --filter name=douyinweb-neko --format '{{.Names}} {{.Status}}' | sort
|
|
""",
|
|
t=90,
|
|
)
|
|
|
|
c.close()
|
|
print("DIAG_DONE")
|