feat: add infrastructure automation and diagnostic scripts for Zabbix, Nginx, and Authentik
This commit is contained in:
24
scripts/fix_swm01_output.py
Normal file
24
scripts/fix_swm01_output.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import paramiko, time
|
||||
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
ssh.connect('140.44.4.71', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
||||
|
||||
def run(cmd):
|
||||
print(f">>> {cmd}")
|
||||
_, o, e = ssh.exec_command(cmd)
|
||||
out = o.read().decode().strip()
|
||||
err = e.read().decode().strip()
|
||||
if out:
|
||||
print(out)
|
||||
if err:
|
||||
print("[stderr]", err)
|
||||
|
||||
run("iptables -t nat -I OUTPUT 1 -p tcp -d 140.44.4.70 --dport 10051 -j DNAT --to-destination 140.44.4.64:10051")
|
||||
run("iptables -t nat -I OUTPUT 2 -p tcp -d 140.44.4.71 --dport 10051 -j DNAT --to-destination 140.44.4.64:10051")
|
||||
run("systemctl restart zabbix-agent2")
|
||||
time.sleep(3)
|
||||
run("tail -n 15 /var/log/zabbix/zabbix_agent2.log")
|
||||
|
||||
ssh.close()
|
||||
|
||||
Reference in New Issue
Block a user