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

23 lines
877 B
Python

#!/usr/bin/env python3
import json
import time
import paramiko
HOST, USER, PASS = "10.88.0.4", "eric", "4669805"
def run(cmd):
c=paramiko.SSHClient(); c.set_missing_host_key_policy(paramiko.AutoAddPolicy()); c.connect(HOST,username=USER,password=PASS,timeout=20)
_,o,e=c.exec_command('export LC_ALL=C.UTF-8; '+cmd,timeout=90)
out=(o.read()+e.read()).decode('utf-8','replace'); c.close(); return out
for i in range(6):
print(f'--- poll {i+1} ---')
print(run("pgrep -af 'ffmpeg.*rtmps' | grep -v pgrep"))
raw=run("curl -sS -m 12 'http://127.0.0.1:8001/process_monitor?family=youtube'")
d=json.loads(raw)
for row in d.get('entries') or []:
if str(row.get('pm2','')).startswith('youtube2__'):
print(row['pm2'], row.get('business_status'), row.get('is_pushing'), row.get('source_display'), row.get('label'))
time.sleep(5)