33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
import paramiko
|
|
import sys
|
|
|
|
sys.stdout.reconfigure(encoding='utf-8')
|
|
|
|
ssh_sp = paramiko.SSHClient()
|
|
ssh_sp.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
ssh_sp.connect('140.44.4.41', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
|
|
|
ssh_swm = paramiko.SSHClient()
|
|
ssh_swm.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
ssh_swm.connect('140.44.4.71', username='snarf', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
|
|
|
def run(ssh, cmd):
|
|
print(f"\n--- {cmd} ---")
|
|
_, out, err = ssh.exec_command(cmd)
|
|
res = out.read().decode('utf-8', errors='replace').strip()
|
|
if res:
|
|
print(res)
|
|
|
|
print("=== PEANUT LOGS (Swarm) ===")
|
|
run(ssh_swm, "sudo docker service logs peanut_peanut --tail=50")
|
|
|
|
print("\n=== CODER LOGS (Spaceport) ===")
|
|
run(ssh_sp, "kubectl logs -n infrastructure -l app.kubernetes.io/name=coder --tail=50")
|
|
|
|
print("\n=== SEMAPHORE LOGS (Spaceport) ===")
|
|
run(ssh_sp, "kubectl logs -n infrastructure -l app.kubernetes.io/name=semaphore --tail=50")
|
|
|
|
ssh_sp.close()
|
|
ssh_swm.close()
|
|
|