Public Access
This commit is contained in:
1 parent
6a4cc97356
commit
e8c2bc4418
2 files changed
+40
-3
No files matched your search
+34
-1
@@ -1,13 +1,46 @@
|
||||
import os
|
||||
import shutil
|
||||
import requests
|
||||
import psutil
|
||||
|
||||
def obtenir_infos_serveur():
|
||||
# Espace disque racine /
|
||||
total, used, free = shutil.disk_usage("/")
|
||||
|
||||
# Espace disque /DATA (partition principale / RAID)
|
||||
# Recherche intelligente de la partition RAID ou /DATA via psutil
|
||||
data_stats = {}
|
||||
try:
|
||||
partitions = psutil.disk_partitions(all=False)
|
||||
for p in partitions:
|
||||
# Priorité à la détection d'un périphérique md (RAID) ou du point de montage /DATA
|
||||
if "md" in p.device or p.mountpoint == "/DATA":
|
||||
try:
|
||||
dt, du, df = shutil.disk_usage(p.mountpoint)
|
||||
data_stats = {
|
||||
"device": p.device,
|
||||
"mountpoint": p.mountpoint,
|
||||
"total_gb": round(dt / (2**30), 2),
|
||||
"utilise_gb": round(du / (2**30), 2),
|
||||
"libre_gb": round(df / (2**30), 2),
|
||||
"pourcentage": round((du / dt) * 100, 1)
|
||||
}
|
||||
if "md" in p.device:
|
||||
break # On privilégie en premier le RAID détecté
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Fallback sur /DATA si aucune détection spécifique md n'a eu lieu
|
||||
if not data_stats and os.path.exists("/DATA"):
|
||||
dt, du, df = shutil.disk_usage("/DATA")
|
||||
data_stats = {
|
||||
"device": "bind-mount /DATA",
|
||||
"mountpoint": "/DATA",
|
||||
"total_gb": round(dt / (2**30), 2),
|
||||
"utilise_gb": round(du / (2**30), 2),
|
||||
"libre_gb": round(df / (2**30), 2),
|
||||
"pourcentage": round((du / dt) * 100, 1)
|
||||
}
|
||||
except Exception:
|
||||
if os.path.exists("/DATA"):
|
||||
dt, du, df = shutil.disk_usage("/DATA")
|
||||
data_stats = {
|
||||
|
||||
@@ -325,8 +325,12 @@ def render_backoffice_page(utilisateur, role, tous_les_utilisateurs, stats_serve
|
||||
sections.append(Div(
|
||||
H3("🖥️ Supervision Système, RAID & Agent Vectoriel", style="color: #ff9800;"),
|
||||
P(f"💾 Espace disque racine : {stats_serveur['disque_utilise_gb']} Go / {stats_serveur['disque_total_gb']} Go ({stats_serveur['pourcentage_utilise']}%)"),
|
||||
(P(f"🗄️ Partition RAID (/DATA) : {data_st.get('utilise_gb', 0)} Go / {data_st.get('total_gb', 0)} Go ({data_st.get('pourcentage', 0)}% utilisés, {data_st.get('libre_gb', 0)} Go libres)") if data_st else P("🗄️ Partition RAID (/DATA) : Non montée ou non détectée")),
|
||||
P(f"📡 État du RAID (mdstat) : {stats_serveur.get('raid_status', 'N/A')}", style="font-size: 0.85em; background: #222; padding: 8px; border-radius: 4px; white-space: pre-wrap;"),
|
||||
(P(f"🗄️ Périphérique RAID ({data_st.get('device', '/DATA')} sur {data_st.get('mountpoint', '/DATA')}) : {data_st.get('utilise_gb', 0)} Go / {data_st.get('total_gb', 0)} Go ({data_st.get('pourcentage', 0)}% utilisés, {data_st.get('libre_gb', 0)} Go libres)") if data_st else P("🗄️ Partition RAID (/DATA) : Non montée ou non détectée")),
|
||||
Div(
|
||||
P("📡 État du RAID (mdstat) :", style="margin-bottom: 5px; font-weight: bold;"),
|
||||
Pre(stats_serveur.get('raid_status', 'N/A'), style="font-size: 0.8em; background: #111; color: #00ffcc; padding: 10px; border-radius: 4px; overflow-x: auto; max-height: 180px; overflow-y: auto; white-space: pre-wrap; font-family: monospace; margin: 0;"),
|
||||
style="margin-bottom: 15px;"
|
||||
),
|
||||
P(f"🤖 Agent Vectoriel (Ollama) : {stats_serveur.get('agent_status', 'N/A')}"),
|
||||
Hr(style="border-color: #444; margin: 15px 0;"),
|
||||
H4("⚡ Actions Globales RAG", style="color: #00e5ff; font-size: 1em;"),
|
||||
|
||||
Reference in new issue
Block a user