30 lines
1.2 KiB
Python
Executable File
30 lines
1.2 KiB
Python
Executable File
import requests
|
|
import os
|
|
import time
|
|
|
|
# Liste des organes vitaux à surveiller
|
|
COMPONENTS = {
|
|
"smtp_smuggler": "http://127.0.0.1:5821/deliverads/smtp-smuggler.php?action=stats",
|
|
"aqualink": "http://127.0.0.1:5821/deliverads/aqualink.php?action=stats",
|
|
"dark_scout": "http://127.0.0.1:5821/deliverads/dark-scout.php?action=stats"
|
|
}
|
|
|
|
def repair_logic():
|
|
for name, url in COMPONENTS.items():
|
|
try:
|
|
r = requests.get(url, timeout=5)
|
|
if r.status_code != 200:
|
|
raise Exception(f"HTTP {r.status_code}")
|
|
print(f"✅ {name} est opérationnel.")
|
|
except Exception as e:
|
|
print(f"⚠️ Défaillance détectée sur {name} : {e}")
|
|
print(f"🔧 Tentative de réparation (Restart Services)...")
|
|
os.system("systemctl restart apache2")
|
|
os.system("systemctl restart postgresql")
|
|
# Log l'incident dans la mémoire de l'IA pour qu'elle s'en souvienne
|
|
requests.post('http://localhost:11434/api/generate',
|
|
json={"model": "llama3.2", "prompt": f"LOG ERREUR : {name} a échoué. J'ai redémarré les services."})
|
|
|
|
if __name__ == "__main__":
|
|
repair_logic()
|