Files
SnarfCode/scripts/test_homepage_backends.py

32 lines
1.5 KiB
Python

import paramiko
import sys
sys.stdout.reconfigure(encoding='utf-8')
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect('140.44.4.41', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
def test_url(name, cmd):
_, o, e = c.exec_command(cmd)
res = o.read().decode().strip()
err = e.read().decode().strip()
print(f"\n--- {name} ---")
if res:
print(res[:300])
if err:
print("[stderr]", err[:200])
test_url("Gitea direct VIP", "curl -s -I http://140.44.4.62:90/api/v1/user -H 'Authorization: token 47c10c54574131c007302b246352f653facb5062'")
test_url("Gitea DNS", "curl -k -s -I https://git.snarfnet.net/api/v1/user -H 'Authorization: token 47c10c54574131c007302b246352f653facb5062'")
test_url("PeaNUT direct VIP", "curl -s -I http://140.44.4.70:8050/api/v1/devices")
test_url("PeaNUT DNS", "curl -k -s -I https://peanut.snarfnet.net/api/v1/devices")
test_url("Uptime Kuma direct VIP", "curl -s -I http://140.44.4.28:448/api/status-page/public")
test_url("Uptime Kuma DNS", "curl -k -s -I https://uptime.snarfnet.net/api/status-page/public")
test_url("NPM DNS", "curl -k -s -I https://nginx.snarfnet.net/api/")
test_url("Glances 140.44.4.11:61208", "curl -s -I http://140.44.4.11:61208/api/4/cpu")
test_url("Longhorn Aerodrome direct", "curl -s -I http://140.44.4.36:80/v1")
test_url("Longhorn Aerodrome DNS", "curl -k -s -I https://longhorn.aerodrome.snarfnet.net/v1")
c.close()