feat: add various infrastructure check and automation scripts
This commit is contained in:
28
scripts/check_pings_from_clusters.py
Normal file
28
scripts/check_pings_from_clusters.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import paramiko
|
||||
import sys
|
||||
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
|
||||
hosts = [
|
||||
('140.44.4.34', 'Aerodrome 04'),
|
||||
('140.44.4.41', 'Spaceport 01'),
|
||||
('140.44.4.71', 'Shipyard 01'),
|
||||
('140.44.4.81', 'Spacedock 01'),
|
||||
]
|
||||
|
||||
for ip, name in hosts:
|
||||
try:
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
if ip == '140.44.4.41':
|
||||
c.connect(ip, username='root', password='dietpi', timeout=5)
|
||||
else:
|
||||
c.connect(ip, username='snarf', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=5)
|
||||
_, stdout, _ = c.exec_command("ping -c 2 -W 2 14.4.4.44")
|
||||
res = stdout.read().decode().strip()
|
||||
has_reply = "64 bytes from 14.4.4.44" in res
|
||||
print(f"{name} ({ip}) -> 14.4.4.44: {'REPLIED' if has_reply else 'NO REPLY'}")
|
||||
c.close()
|
||||
except Exception as e:
|
||||
print(f"{name} ({ip}) error: {e}")
|
||||
|
||||
Reference in New Issue
Block a user