- Correction simulateur: nettoyage code FIWARE (erreurs syntaxe) - Grafana: dashboard complet 10 panneaux sur grafana.digitribe.fr - InfluxDB: datasource corrigée (bucket smartcity, org digitribe) - Nettoyage: suppression services FIWARE (Orion-LD, Stellio, QuantumLeap) - Pipeline validé: Simulator → 3 MQTT brokers → Telegraf → InfluxDB → Grafana - Dashboard URL: https://grafana.digitribe.fr/d/smartcity-martinique-complete/ Architecture simplifiée: - 3 MQTT brokers (EMQX, Mosquitto, BunkerM) - Telegraf pour agrégation - InfluxDB pour stockage time-series - Grafana pour visualisation (Traefik: grafana.digitribe.fr)
94 lines
4.1 KiB
Markdown
94 lines
4.1 KiB
Markdown
# Smart City Digital Twin - Martinique
|
|
## Nouvelle Architecture (Mise à jour 08/05/2026)
|
|
|
|
### Stack Simplifiée
|
|
```
|
|
Simulateur Python (60 capteurs)
|
|
↓
|
|
┌───────────────────────────────────────────────┐
|
|
│ 3 Brokers MQTT │
|
|
│ ┌────────────┐ ┌────────────┐ ┌────────────┐ │
|
|
│ │ EMQX │ │ Mosquitto │ │ BunkerM │ │
|
|
│ │(emqx_emqx_1)│ │(smart-city- │ │(bunkerm_ │ │
|
|
│ │ │ │ mosquitto) │ │ bunkerm_1)│ │
|
|
│ └─────┬──────┘ └─────┬──────┘ └─────┬──────┘ │
|
|
└────────┼──────────────┼──────────────┼──────────────┘
|
|
│ │ │
|
|
└──────────────┴──────────────┘
|
|
↓
|
|
Telegraf (3 inputs MQTT)
|
|
↓
|
|
InfluxDB v2
|
|
(bucket: smartcity)
|
|
↓
|
|
Grafana
|
|
(Dashboard: smartcity-martinique-2026)
|
|
```
|
|
|
|
### Détails des Composants
|
|
|
|
#### 1. Simulateur (`smart-city-simulator`)
|
|
- **Fonction** : Génère des données IoT simulées (60 capteurs)
|
|
- **Types** : AirQuality, Traffic, Parking, Noise, Weather, Light
|
|
- **Brokers MQTT** : Publie sur les 3 brokers simultanément
|
|
- EMQX: `emqx_emqx_1:1883` (MQTT v3.1.1)
|
|
- Mosquitto: `smart-city-mosquitto:1883` (MQTT v3.1.1)
|
|
- BunkerM: `bunkerm_bunkerm_1:1900` (MQTT v3.1.1, auth: bunker/bunker)
|
|
- **InfluxDB** : Écriture asynchrone (ASYNCHRONOUS) vers `smartcity` bucket
|
|
|
|
#### 2. Telegraf (`smart-city-telegraf`)
|
|
- **Fonction** : Collecte les données MQTT et les écrit dans InfluxDB
|
|
- **Configuration** : 3 inputs MQTT (un par broker)
|
|
- **Topics** : `airquality/#`, `traffic/#`, `parking/#`, `noise/#`, `weather/#`, `light/#`
|
|
- **Format** : JSON → InfluxDB line protocol
|
|
|
|
#### 3. InfluxDB (`smart-city-influxdb`)
|
|
- **Version** : v2.7.12
|
|
- **Organization** : digitribe
|
|
- **Bucket** : `smartcity` (infinite retention)
|
|
- **Token** : `my-super-token`
|
|
|
|
#### 4. Grafana (`smart-city-grafana`)
|
|
- **URL** : http://localhost:3001
|
|
- **Credentials** : admin / Digitribe972
|
|
- **Dashboard** : Smart City Digital Twin - Martinique
|
|
- UID: `smartcity-martinique-2026`
|
|
- 6 panneaux (AirQuality, Traffic, Parking, Noise, Weather, Light)
|
|
- Source: InfluxDB (`smartcity` bucket)
|
|
|
|
### Flux de Données
|
|
1. **Simulateur** publie sur 3 brokers MQTT (EMQX, Mosquitto, BunkerM)
|
|
2. **Telegraf** subscribe aux topics MQTT → convertit en format InfluxDB
|
|
3. **InfluxDB** stock les séries temporelles
|
|
4. **Grafana** visualise les données via Flux queries
|
|
|
|
### Avantages de cette Architecture
|
|
- ✅ **Simplicité** : Pas de FIWARE (Orion-LD, Stellio, QuantumLeap)
|
|
- ✅ **Performance** : InfluxDB optimisé pour les séries temporelles
|
|
- ✅ **Redondance** : 3 brokers MQTT (si un tombe, les autres assurent)
|
|
- ✅ **Maintnant** : Stack standard (Telegraf/InfluxDB/Grafana)
|
|
|
|
### Commandes Utiles
|
|
```bash
|
|
# Vérifier les données InfluxDB
|
|
docker exec smart-city-influxdb influx query 'from(bucket:"smartcity") |> range(start:-1h) |> group(columns: ["_measurement"]) |> count()'
|
|
|
|
# Voir les logs du simulateur
|
|
docker logs smart-city-simulator --tail 50
|
|
|
|
# Redémarrer Telegraf
|
|
docker restart smart-city-telegraf
|
|
|
|
# Accéder à Grafana
|
|
open http://localhost:3001
|
|
```
|
|
|
|
### Fichiers de Configuration
|
|
- **Simulateur** : `/home/eric/smart-city-digital-twin-martinique/simulator.py`
|
|
- **Telegraf** : `/home/eric/smart-city-digital-twin-martinique/telegraf.conf`
|
|
- **Docker Compose** : `/home/eric/smart-city-digital-twin-martinique/docker-compose.yml`
|
|
- **Dashboard Grafana** : `/home/eric/smart-city-digital-twin-martinique/grafana-dashboard-smartcity.json`
|
|
|
|
---
|
|
*Dernière mise à jour : 08/05/2026 - Suppression de FIWARE, passage à Telegraf/InfluxDB*
|