sh2/d2ypp2/tools/_diag_host05_lane1.py
2026-06-14 18:35:41 -05:00

34 lines
1.4 KiB
Python

#!/usr/bin/env python3
import paramiko
import sys
HOST, PW, BASE = "10.88.0.5", "4669805", "/opt/live/d2ypp"
CMDS = [
("lanes", f"ls -1 {BASE}/config/youtube.youtube2__*.ini"),
("keys", f"grep -H '^key' {BASE}/config/youtube.youtube2__*.ini"),
("pm2", "pm2 list 2>/dev/null || true"),
("logs", f"ls -lt {BASE}/.pm2/logs/youtube2__*-out.log 2>/dev/null | head -5"),
("speed", f"grep -E 'speed=|invalid dropping|YouTube Live profile|fast_audio|LIVE_VIDEO' {BASE}/.pm2/logs/youtube2__*-out.log 2>/dev/null | tail -50"),
("tail1", f"tail -60 $(ls -t {BASE}/.pm2/logs/youtube2__*-out.log 2>/dev/null | head -1) 2>/dev/null"),
("ffmpeg", "ps auxww | grep 'ffmpeg.*rtmps' | grep -v grep"),
("vaapi", "ffmpeg -hide_banner -encoders 2>/dev/null | grep h264_vaapi; ls -la /dev/dri/renderD128 2>/dev/null"),
]
def main() -> None:
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(HOST, username="eric", password=PW, timeout=15)
for name, cmd in CMDS:
sys.stdout.buffer.write(f"\n=== {name} ===\n".encode())
_, stdout, stderr = c.exec_command(cmd, timeout=90)
out = (stdout.read() + stderr.read()).decode("utf-8", "replace")
sys.stdout.buffer.write(out.encode("utf-8", "replace"))
sys.stdout.buffer.write(b"\n")
c.close()
if __name__ == "__main__":
main()