16 lines
598 B
Python
16 lines
598 B
Python
#!/usr/bin/env python3
|
|
import paramiko
|
|
|
|
for host, pw in [("10.88.0.4", "4669805"), ("10.88.0.5", "4669805")]:
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(host, username="eric", password=pw, timeout=15)
|
|
cmd = (
|
|
"for pid in $(pgrep -f 'ffmpeg.*rtmps'); do echo PID=$pid; "
|
|
"timeout 2 cat /proc/$pid/fd/2 2>/dev/null | tr '\\r' '\\n' | grep speed= | tail -2; done"
|
|
)
|
|
print(f"=== {host} ===")
|
|
_, o, e = c.exec_command(cmd, timeout=20, get_pty=True)
|
|
print((o.read() + e.read()).decode()[:800])
|
|
c.close()
|