#!/usr/bin/env python3 import paramiko, sys c=paramiko.SSHClient(); c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect('10.88.0.5', username='eric', password='4669805', timeout=15) log='/opt/live/d2ypp/.pm2/logs/youtube2__ch_mp9mm36r_2wn0r-out.log' cmds=[ ('tail', f'tail -40 {log}'), ('ffmpeg', "ps auxww | grep ffmpeg | grep -v grep"), ('monitor', "curl -sS -m 10 'http://127.0.0.1:8001/process_monitor?family=youtube&light=1' | python3 -c \"import json,sys; d=json.load(sys.stdin); print('\\n'.join(f\\\"{e.get('pm2')}: {e.get('business_status')} speed={e.get('ffmpeg_speed')} proc={e.get('process_status')}\\\" for e in d.get('entries',[])))\" 2>&1"), ] for n,cmd in cmds: print('===',n,'===') _,o,e=c.exec_command(cmd, timeout=60) sys.stdout.buffer.write((o.read()+e.read()).decode('utf-8','replace').encode('utf-8','replace')) sys.stdout.buffer.write(b'\n') c.close()