feat(idrac): add iDRAC cluster check script and update redirection helpers
This commit is contained in:
25
scripts/check_idrac_cluster.py
Normal file
25
scripts/check_idrac_cluster.py
Normal file
@@ -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}")
|
||||||
@@ -19,3 +19,4 @@ stdin, stdout, stderr = client.exec_command(cmd)
|
|||||||
print(stdout.read().decode())
|
print(stdout.read().decode())
|
||||||
print(stderr.read().decode())
|
print(stderr.read().decode())
|
||||||
client.close()
|
client.close()
|
||||||
|
|
||||||
|
|||||||
@@ -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.exec_command("for id in $(docker ps -q -f name=nginx-proxy-manager_app); do docker exec $id nginx -s reload; done")
|
||||||
client2.close()
|
client2.close()
|
||||||
print("Reloaded Nginx across NPM swarm replicas")
|
print("Reloaded Nginx across NPM swarm replicas")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user