feat: add diagnostic scripts for gateway and DNS investigation
This commit is contained in:
20
scripts/check_gateway.py
Normal file
20
scripts/check_gateway.py
Normal file
@@ -0,0 +1,20 @@
|
||||
import paramiko
|
||||
import sys
|
||||
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
|
||||
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=10)
|
||||
|
||||
stdin, stdout, stderr = c.exec_command("curl -k -s -I http://140.44.4.1/ || curl -k -s -I https://140.44.4.1/")
|
||||
print("Gateway 140.44.4.1 HTTP headers:")
|
||||
print(stdout.read().decode('utf-8'))
|
||||
|
||||
stdin, stdout, stderr = c.exec_command("arp -an | grep 140.44.4.1")
|
||||
print("ARP for 140.44.4.1:")
|
||||
print(stdout.read().decode('utf-8'))
|
||||
|
||||
c.close()
|
||||
|
||||
16
scripts/check_gateway_type.py
Normal file
16
scripts/check_gateway_type.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import paramiko
|
||||
import sys
|
||||
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
|
||||
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=10)
|
||||
|
||||
stdin, stdout, stderr = c.exec_command("curl -k -s -L https://140.44.4.1/ | grep -iE 'title|unifi|opnsense|pfsense|mikrotik|netgate|firewall|router'")
|
||||
print("Gateway 140.44.4.1 HTML match:")
|
||||
print(stdout.read().decode('utf-8'))
|
||||
|
||||
c.close()
|
||||
|
||||
25
scripts/check_pending_reasons.py
Normal file
25
scripts/check_pending_reasons.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import paramiko
|
||||
import sys
|
||||
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
|
||||
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=10)
|
||||
|
||||
stdin, stdout, stderr = c.exec_command("k3s kubectl -n infra get events --field-selector reason=FailedScheduling")
|
||||
print("Aerodrome Scheduling Events:")
|
||||
print(stdout.read().decode('utf-8'))
|
||||
c.close()
|
||||
|
||||
c2 = paramiko.SSHClient()
|
||||
c2.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c2.connect("140.44.4.41", username="root", key_filename=key_path, timeout=10)
|
||||
|
||||
stdin, stdout, stderr = c2.exec_command("k3s kubectl -n infrastructure get events --field-selector reason=FailedScheduling")
|
||||
print("Spaceport Scheduling Events:")
|
||||
print(stdout.read().decode('utf-8'))
|
||||
c2.close()
|
||||
|
||||
@@ -11,3 +11,4 @@ for root, dirs, files in os.walk(r"c:\Users\Snarf\OneDrive\Desktop\code\SnarfCod
|
||||
|
||||
for m in matches[:30]:
|
||||
print(m)
|
||||
|
||||
|
||||
30
scripts/inspect_dns_details.py
Normal file
30
scripts/inspect_dns_details.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import paramiko
|
||||
import sys
|
||||
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
|
||||
key_path = r"C:\Users\Snarf\.ssh\id_ed25519_snarfnet"
|
||||
|
||||
def check(host, ns, name):
|
||||
print(f"\n=================== {name} ({host}) ===================")
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect(host, username="root", key_filename=key_path, timeout=10)
|
||||
|
||||
print("\n--- Pods in ns " + ns + " ---")
|
||||
stdin, stdout, stderr = c.exec_command(f"k3s kubectl -n {ns} get pods -o wide")
|
||||
print(stdout.read().decode('utf-8'))
|
||||
|
||||
print("\n--- Pihole Pod describe/logs ---")
|
||||
stdin, stdout, stderr = c.exec_command(f"k3s kubectl -n {ns} describe deploy/pihole | grep -E 'Image:|Environment|Mounts|Volumes'")
|
||||
print(stdout.read().decode('utf-8'))
|
||||
|
||||
print("\n--- Technitium Pod describe/logs ---")
|
||||
stdin, stdout, stderr = c.exec_command(f"k3s kubectl -n {ns} describe deploy/technitium-dns | grep -E 'Image:|Environment|Mounts|Volumes'")
|
||||
print(stdout.read().decode('utf-8'))
|
||||
|
||||
c.close()
|
||||
|
||||
check("140.44.4.11", "infra", "Aerodrome")
|
||||
check("140.44.4.41", "infrastructure", "Spaceport")
|
||||
|
||||
@@ -31,3 +31,4 @@ def check(host, name):
|
||||
|
||||
check("140.44.4.11", "Aerodrome")
|
||||
check("140.44.4.41", "Spaceport")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user