feat: add various infrastructure and service diagnostic scripts

This commit is contained in:
2026-11-06 09:02:19 -05:00
parent 00f22f33af
commit 1b8c862b10
59 changed files with 1499 additions and 58 deletions

View File

@@ -1,20 +1,44 @@
import paramiko
import sys
sys.stdout.reconfigure(encoding='utf-8')
def check_cluster(host, name):
print(f"=== Checking {name} ({host}) ===")
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host, username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
key_path = r"C:\Users\Snarf\.ssh\id_ed25519_snarfnet"
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("140.44.4.11", username="root", key_filename=key_path, timeout=5)
stdin, stdout, stderr = ssh.exec_command('k3s kubectl get pods -n dns -o wide')
print("Pods:")
print(stdout.read().decode())
stdin, stdout, stderr = c.exec_command("k3s kubectl -n dns get pods,svc")
print("=== PODS & SVCS ===")
print(stdout.read().decode('utf-8'))
stdin, stdout, stderr = ssh.exec_command('k3s kubectl exec -n dns deployment/pihole -- pihole -v')
print("Pihole version:")
print(stdout.read().decode())
stdin, stdout, stderr = c.exec_command("k3s kubectl -n dns describe svc pihole-dns-vip | grep -E 'Events:|Message|Failed'")
print("=== SERVICE EVENTS ===")
print(stdout.read().decode('utf-8'))
# Set password explicitly
stdin, stdout, stderr = ssh.exec_command('k3s kubectl exec -n dns deployment/pihole -- pihole setpassword snarfnetadmin')
out = stdout.read().decode()
err = stderr.read().decode()
print("Set password with pihole setpassword:")
print(out)
if err:
print("ERR:", err)
c.close()
if "Unknown" in out or "invalid" in out.lower() or err:
stdin, stdout, stderr = ssh.exec_command('k3s kubectl exec -n dns deployment/pihole -- pihole -a -p snarfnetadmin')
print("Fallback pihole -a -p:")
print(stdout.read().decode())
# Check Technitium login via API
stdin, stdout, stderr = ssh.exec_command('k3s kubectl exec -n dns deployment/technitium-dns -- curl -s "http://localhost:5380/api/user/login?user=admin&pass=snarfnetadmin"')
login_res = stdout.read().decode()
print("Technitium API Login:", login_res)
# Check Technitium SSO config
stdin, stdout, stderr = ssh.exec_command("k3s kubectl exec -n dns deployment/technitium-dns -- cat /etc/dns/auth.config 2>/dev/null || echo 'No auth.config'")
print("Technitium auth.config:")
print(stdout.read().decode())
ssh.close()
check_cluster('140.44.4.11', 'Aerodrome')
check_cluster('140.44.4.41', 'Spaceport')