A complete autonomous IoT monitoring system:
- 7 agents running concurrently (Monitoring, Anomaly, Diagnosis, Recovery, Learning, Security, RemoteDeviceManager)
- LLM-powered diagnosis via Groq (free, fast) or Ollama (local, offline)
- Multi-device support — any machine on your network can send metrics to the hub
- Self-healing recovery — 15+ actions, 4 escalation levels, outcome verification
- Real-time dashboard — dark glassmorphism UI at http://localhost:5001
- Python 3.9+
- Ollama installed:
brew install ollama - Dependencies installed in venv (already done if you received this project)
cd /Users/karthi/Desktop/Sentinal_AI/sentinel_ai
kill $(lsof -ti :5001) 2>/dev/null; pkill -f "python.*main.py" 2>/dev/null
source venv/bin/activate
brew services start ollama
python main.pyOpen the dashboard: http://localhost:5001
- Four SVG arc gauges: CPU / Memory / Disk / Power
- Agent status cards (green = running)
- Toast notifications appear top-right when anomalies fire
- Real-time line chart: CPU, Memory, Disk, Power Quality
- "Learned fence" badges show the adaptive anomaly thresholds
Trigger controlled failures to watch the full pipeline:
- Click CPU Spike — CPU goes to 95% for 60 seconds
- Wait ~15 seconds — anomaly fires, toast appears
- Watch the Diagnosis and Recovery cards populate
- Check the Incidents tab for the full event record
Monitor remote machines:
- Connect a remote device (see below)
- It appears in the left sidebar with a green dot
- Click the device name to open its full panel
- Run stress tests on the remote device directly from the dashboard
Full timeline of every detected anomaly with diagnosis, recovery actions, and outcome.
Copy sentinel_client_package/ to the remote machine, then:
bash connect.sh
# Follow the prompts — it installs dependencies, tests connectivity, and connectspip install psutil requests
python sentinel_client.py --hub http://<HUB_IP>:5001 --device MyLaptopipconfig getifaddr en0python sentinel_client.py --hub http://<HUB_IP>:5001 --testRemote Device / Local Sensors
|
v
MonitoringAgent ------> EventBus ------> AnomalyDetectionAgent
|
(IQR + Z-score + Isolation Forest + LSTM)
|
v
DiagnosisAgent
(Rules + Groq AI + Ollama)
|
v
RecoveryAgent
(Level 1-4 graduated actions)
|
v
LearningAgent
(SQLite persistence, threshold adaptation)
SecurityAgent runs independently, publishing security.threat events directly to the bus.
| Provider | When Used | Config |
|---|---|---|
| Groq llama-3.3-70b | Primary diagnosis AI | groq.enabled: true in config.yaml |
| Ollama llama3.2:3b | Fallback when Groq unavailable | Runs locally via brew services start ollama |
| Isolation Forest | Multivariate anomaly detection | Always active, no config needed |
| LSTM Autoencoder | Time-series anomaly (trains after ~6.5 min) | Keras + PyTorch backend |
Edit sentinel_ai/config/config.yaml:
anomaly_detection:
min_consecutive_readings: 2 # readings before alert fires
cooldown_minutes: 5 # cooldown per metric after alert
groq:
enabled: true
model: "llama-3.3-70b-versatile"
api_key: "" # or set GROQ_API_KEY in .env
recovery:
escalation_window_minutes: 30
monitoring:
collection_interval: 5 # seconds between metric collectioncd sentinel_ai
source venv/bin/activate
python -m pytest tests/test_unit.py -v
# 52 unit tests covering all core componentssentinel_ai/
+-- main.py # Start here — starts all 7 agents + dashboard
+-- sentinel_client.py # Copy this to remote machines
+-- agents/
| +-- monitoring/ # Collects metrics every 5s
| +-- anomaly/ # 4 detection methods
| +-- diagnosis/ # Groq + Ollama + rules
| +-- recovery/ # 15+ recovery actions
| +-- learning/ # Incident DB + adaptation
| +-- security/ # Threat scanning
+-- dashboard/app.py # Flask server (port 5001)
+-- dashboard/templates/ # Single-page UI
+-- config/config.yaml # All settings
+-- tests/test_unit.py # 52 tests
- Start hub:
python main.py - Wait 3 minutes (baseline warmup)
- Open Simulation Lab tab
- Click CPU Spike
- Watch: toast notification -> Incidents tab populates -> Recovery executes
- Get hub IP:
ipconfig getifaddr en0 - On remote machine:
bash connect.sh - Open Distributed Devices tab
- Click the remote device name
- Click CPU Spike in the Controlled Instability card
curl http://localhost:5001/api/thresholds | python3 -m json.toolReturns the live IQR upper bounds learned from the last N data points.
| Problem | Fix |
|---|---|
| Port 5001 in use | kill $(lsof -ti :5001) |
| No anomalies firing | Wait 3 min warmup; run a simulation |
| Remote client SSL error | Use http:// not https:// |
| Remote client connection refused | Check hub IP; hub must be running main.py |
| Ollama not responding | brew services restart ollama |
| Duplicate incidents flooding | Always pkill -f "python.*main.py" before restarting |