Files
SnarfCode/scripts/check_longhorn_semaphore.py

34 lines
1.3 KiB
Python

import paramiko
import sys
sys.stdout.reconfigure(encoding='utf-8')
key_path = r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet'
def run_ssh(host, user, cmd):
print(f"=== SSH {user}@{host}: {cmd} ===")
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
ssh.connect(host, username=user, key_filename=key_path, timeout=10)
stdin, stdout, stderr = ssh.exec_command(cmd)
out = stdout.read().decode('utf-8', errors='replace')
err = stderr.read().decode('utf-8', errors='replace')
if out:
print(out)
if err:
print("STDERR:", err)
except Exception as e:
print(f"Error connecting to {host}: {e}")
finally:
ssh.close()
# Aerodrome Longhorn Ingress
run_ssh('140.44.4.11', 'root', 'k3s kubectl get ingress -A | grep -i longhorn')
run_ssh('140.44.4.11', 'root', 'k3s kubectl get ingress -n longhorn-system -o yaml')
# Spaceport Semaphore Ingress & Deployment
run_ssh('140.44.4.41', 'root', 'k3s kubectl get ingress -A | grep -i semaphore')
run_ssh('140.44.4.41', 'root', 'k3s kubectl get deployment -A | grep -i semaphore')
run_ssh('140.44.4.41', 'root', 'k3s kubectl get deployment -n infrastructure semaphore -o jsonpath="{.spec.template.spec.containers[0].env}"')