diff --git a/scripts/check_idrac_cluster.py b/scripts/check_idrac_cluster.py new file mode 100644 index 0000000..8ef1a51 --- /dev/null +++ b/scripts/check_idrac_cluster.py @@ -0,0 +1,25 @@ +import paramiko + +nodes = ["140.44.44.121", "140.44.44.122", "140.44.44.123", "140.44.44.124"] + +for ip in nodes: + try: + c = paramiko.SSHClient() + c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + c.connect(ip, username="root", password="Katzir476!", timeout=10) + + stdin, stdout, stderr = c.exec_command("racadm serveraction powerstatus") + power = stdout.read().decode().strip() + + stdin, stdout, stderr = c.exec_command("racadm get System.ServerInfo.ServiceTag") + out_tag = stdout.read().decode().strip() + tag = [line for line in out_tag.splitlines() if line and not line.startswith("racadm") and not line.startswith("[")][-1] if out_tag else "Unknown" + + stdin, stdout, stderr = c.exec_command("racadm get System.ServerInfo.HostName") + out_name = stdout.read().decode().strip() + name = [line for line in out_name.splitlines() if line and not line.startswith("racadm") and not line.startswith("[")][-1] if out_name else "Unknown" + + print(f"[{ip}] {power} | {tag} | {name}") + c.close() + except Exception as e: + print(f"[{ip}] ERROR: {e}") diff --git a/scripts/check_snarfhome.py b/scripts/check_snarfhome.py index 1f5a717..b99bf0c 100644 --- a/scripts/check_snarfhome.py +++ b/scripts/check_snarfhome.py @@ -19,3 +19,4 @@ stdin, stdout, stderr = client.exec_command(cmd) print(stdout.read().decode()) print(stderr.read().decode()) client.close() + diff --git a/scripts/fix_snarfhome_redirection.py b/scripts/fix_snarfhome_redirection.py index fbc77ac..667c0b0 100644 --- a/scripts/fix_snarfhome_redirection.py +++ b/scripts/fix_snarfhome_redirection.py @@ -66,3 +66,4 @@ client2.connect("140.44.4.72", username="root", key_filename=r"C:\Users\Snarf\.s client2.exec_command("for id in $(docker ps -q -f name=nginx-proxy-manager_app); do docker exec $id nginx -s reload; done") client2.close() print("Reloaded Nginx across NPM swarm replicas") +