sh2/d2ypp2/tools/remote_hw_check.py
2026-06-14 10:41:48 -05:00

37 lines
1.5 KiB
Python

#!/usr/bin/env python3
from __future__ import annotations
import paramiko
HOST, USER, PASS = "10.88.0.4", "eric", "4669805"
def run(c, cmd):
_, o, e = c.exec_command(cmd, timeout=45, get_pty=True)
return (o.read() + e.read()).decode("utf-8", "replace").strip()
def main() -> None:
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(HOST, username=USER, password=PASS, timeout=20)
cmds = [
"cat /home/eric/d2ypp2-src/config/hardware.env 2>/dev/null || echo NO_HW_ENV",
"ls -la /dev/dri/ 2>/dev/null; ls /dev/mpp_service 2>/dev/null; nvidia-smi 2>/dev/null | head -8",
"ffmpeg -hide_banner -encoders 2>/dev/null | grep -E '264|265|vaapi|nvenc|rkmpp|v4l2'",
"top -bn1 | head -20",
"ps -o pid,pcpu,pmem,etime,cmd -p $(pgrep -f 'ffmpeg.*rtmps://a.rtmps.youtube.com' | tr '\\n' ',') 2>/dev/null",
"grep -E 'NVENC|VAAPI|libx264|hardware|Encoder|fast_audio' /home/eric/d2ypp2-src/logs/*.log 2>/dev/null | tail -30",
f"echo '{PASS}' | sudo -S -p '' journalctl -u 'youtube2__ch_*' --no-pager -n 5 2>/dev/null | tail -20",
"systemctl list-units 'youtube*' --all --no-pager 2>/dev/null | head -15",
"ls -la /home/eric/d2ypp2-src/logs/ 2>/dev/null",
"find /home/eric/d2ypp2-src -name '*.log' -mmin -120 2>/dev/null | head -20",
]
for cmd in cmds:
print(f"\n=== {cmd[:70]} ===\n{run(c, cmd)[:5000]}")
c.close()
if __name__ == "__main__":
main()