Files
Geniusia_v2/monitor_workflows.sh
2026-03-05 00:20:25 +01:00

67 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
# Script de monitoring des workflows en temps réel
LOG_FILE="geniusia2/data/logs/logs_2025-11-18.json"
echo "🔍 Monitoring des workflows en temps réel..."
echo "📁 Fichier: $LOG_FILE"
echo ""
echo "Appuie sur Ctrl+C pour arrêter"
echo "=" | tr '=' '=' | head -c 60
echo ""
# Suivre le fichier de log
tail -f "$LOG_FILE" | while read line; do
# Filtrer les événements intéressants
if echo "$line" | grep -q "session_started\|session_completed\|workflow_detected\|workflow_analysis"; then
# Parser le JSON et afficher joliment
echo "$line" | python3 -c "
import sys, json
try:
data = json.loads(sys.stdin.read())
action = data.get('action', 'unknown')
timestamp = data.get('timestamp', '')
if action == 'session_started':
session_id = data.get('session_id', '')
window = data.get('window', '')
print(f'🟢 SESSION DÉMARRÉE')
print(f' ID: {session_id}')
print(f' Fenêtre: {window}')
print(f' Heure: {timestamp}')
elif action == 'session_completed':
session_id = data.get('session_id', '')
action_count = data.get('action_count', 0)
duration = data.get('duration_seconds', 0)
window = data.get('window', '')
print(f'🔵 SESSION TERMINÉE')
print(f' ID: {session_id}')
print(f' Fenêtre: {window}')
print(f' Actions: {action_count}')
print(f' Durée: {duration:.1f}s')
elif action == 'workflow_detected':
workflow_id = data.get('workflow_id', '')
workflow_name = data.get('workflow_name', '')
steps = data.get('steps', 0)
confidence = data.get('confidence', 0)
print(f'🎯 WORKFLOW DÉTECTÉ !')
print(f' ID: {workflow_id}')
print(f' Nom: {workflow_name}')
print(f' Étapes: {steps}')
print(f' Confiance: {confidence:.0%}')
elif action == 'workflow_analysis_failed':
error = data.get('error', '')
print(f'❌ ERREUR ANALYSE WORKFLOW')
print(f' Erreur: {error}')
print('')
except Exception as e:
pass
" 2>/dev/null
fi
done