import socket import paramiko def check_dns(): print("--- DNS Check ---") try: ip = socket.gethostbyname("argo.snarfnet.net") print(f"argo.snarfnet.net resolves to: {ip}") except Exception as e: print(f"DNS lookup error: {e}") def check_npm(): print("\n--- NPM Database Check (140.44.4.71) ---") ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect('140.44.4.71', username='snarf', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10) # Check sqlite db or active nginx config in npm cmd = """sudo python3 -c "import sqlite3; con = sqlite3.connect('/mnt/nfs_shares/nginx_proxy_manager/database.sqlite'); cur = con.cursor(); print(list(cur.execute(\\"SELECT id, domain_names, forward_host, forward_port, forward_scheme, enabled, is_deleted FROM proxy_host WHERE domain_names LIKE '%argo%'\\")))" """ stdin, stdout, stderr = ssh.exec_command(cmd) out = stdout.read().decode().strip() err = stderr.read().decode().strip() print("NPM DB Proxy Host for argo:") print(out) if err: print("Error/stderr:", err) # Check generated nginx config files cmd2 = "sudo grep -rn 'argo.snarfnet.net' /mnt/nfs_shares/nginx_proxy_manager/nginx/proxy_host/ || true" stdin, stdout, stderr = ssh.exec_command(cmd2) print("NPM config match:") print(stdout.read().decode().strip()) ssh.close() def check_spaceport_argo(): print("\n--- Spaceport ArgoCD K8s Check (140.44.4.41) ---") ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect('140.44.4.41', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10) cmd = "kubectl get ingress,svc,pod -n infrastructure | grep -i argo" stdin, stdout, stderr = ssh.exec_command(cmd) print("Spaceport Argo Resources:") print(stdout.read().decode().strip()) # Check Ingress YAML cmd2 = "kubectl get ingress -n infrastructure -o yaml" stdin, stdout, stderr = ssh.exec_command(cmd2) ingress_yaml = stdout.read().decode().strip() print("\nAll Ingresses in infrastructure:") for line in ingress_yaml.splitlines(): if "name:" in line or "host:" in line or "service:" in line or "port:" in line: print(" ", line) ssh.close() if __name__ == '__main__': check_dns() try: check_npm() except Exception as e: print("NPM check failed:", e) try: check_spaceport_argo() except Exception as e: print("Spaceport check failed:", e)