feat: add cluster auditing, management, and upgrade scripts
This commit is contained in:
27
scripts/check_wrk03_fail.py
Normal file
27
scripts/check_wrk03_fail.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import paramiko
|
||||
import sys
|
||||
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
ssh.connect('140.44.4.11', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
||||
|
||||
py_check = """
|
||||
from awx.main.models import Job
|
||||
job = Job.objects.get(id=134)
|
||||
events = job.job_events.filter(event='runner_on_failed')
|
||||
for e in events:
|
||||
print(f"FAILED Host: {e.event_data.get('host')}, Task: {e.event_data.get('task')}")
|
||||
print(f"Res: {e.event_data.get('res')}")
|
||||
"""
|
||||
|
||||
cmd = f"kubectl exec -i -n awx -c awx-task deployment/awx-task -- awx-manage shell_plus --quiet << 'EOF'\n{py_check}\nEOF"
|
||||
stdin, stdout, stderr = ssh.exec_command(cmd)
|
||||
print(stdout.read().decode())
|
||||
|
||||
_, out, _ = ssh.exec_command('kubectl get pods -A --field-selector spec.nodeName=sninfr2lnxwrk03')
|
||||
print("Pods on wrk03:\n", out.read().decode())
|
||||
|
||||
ssh.close()
|
||||
|
||||
Reference in New Issue
Block a user