feat: add various infrastructure check and automation scripts
This commit is contained in:
28
scripts/check_services.py
Normal file
28
scripts/check_services.py
Normal file
@@ -0,0 +1,28 @@
|
||||
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.71', username='snarf', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
||||
|
||||
def run(cmd):
|
||||
stdin, stdout, stderr = c.exec_command(cmd)
|
||||
out = stdout.read().decode('utf-8', errors='replace')
|
||||
err = stderr.read().decode('utf-8', errors='replace')
|
||||
return out.strip(), err.strip()
|
||||
|
||||
print("Docker services:")
|
||||
out, _ = run("docker service ls")
|
||||
print(out)
|
||||
|
||||
print("\nDocker stack ls:")
|
||||
out, _ = run("docker stack ls")
|
||||
print(out)
|
||||
|
||||
print("\nDocker ps on manager (140.44.4.71):")
|
||||
out, _ = run("docker ps --format 'table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}'")
|
||||
print(out)
|
||||
|
||||
c.close()
|
||||
|
||||
Reference in New Issue
Block a user