diff --git a/GRAFANA-STATUS-FINAL.md b/GRAFANA-STATUS-FINAL.md new file mode 100644 index 00000000..c0bf2cc4 --- /dev/null +++ b/GRAFANA-STATUS-FINAL.md @@ -0,0 +1,77 @@ +# Grafana Datasources - STATUT FINAL (2026-05-05) + +## ✅ Ce qui marche +- **Prometheus** : Fonctionne parfaitement (plugin natif Grafana + réseau partagé `smartcity-shared`) + +## ❌ Ce qui ne marche pas (et pourquoi) + +### 1. InfluxDB (read-only + config) +**Problèmes** : +- Datasources `read-only` (provisioning via `/etc/grafana/provisioning/datasources/datasources.yml`) +- Health check `/api/datasources/{uid}/health` renvoie `id is invalid` +- **Solution** : + ```bash + # Modifier le fichier provisioning DANS le container ou sur l'hôte monté + # Configurer : URL, Token (v2), Organization, DefaultBucket + ``` + +### 2. Orion-LD / FROST / Stellio (incompatibilité plugin) +**Problème critique** : +- Plugin `grafana-simple-json-datasource` **INCOMPATIBLE** +- Ces services n'implémentent PAS l'API simple-json (search, query, annotations) +- Ils ont leurs propres APIs : NGSI-LD, SensorThings + +**Solutions** : +#### Option A : Plugin NGSI-LD dédié +```bash +docker exec digital-twin-grafana grafana-cli plugins install +``` + +#### Option B : Micro-service adaptateur (Node.js/Python) +1. Créer un service qui implémente l'API simple-json +2. Traduit requêtes Grafana → NGSI-LD/SensorThings +3. Exposer sur port 9000, configurer simple-json vers ce service + +#### Option C : API HTTP directe (panels) +1. Installer plugin "JSON API" ou "HTTP" +2. Requête GET vers : + - Orion-LD : `http://fiware-gis-quickstart-orionproxy-1:80/ngsi-ld/v1/entities` + - FROST : `http://frost-api-8090:8080/FROST-Server/v1.1/Things` + - Stellio : `http://stellio-api-gateway:8080/ngsi-ld/v1/entities` +3. Parser JSON dans le panel + +## 🔧 Actions accomplies +1. ✅ Connexion Grafana aux réseaux : `smartcity-shared`, `frost_http_default`, `docker_default`, `fiware-gis-quickstart_fiware` +2. ✅ Testé accessibilité depuis container Grafana : + - InfluxDB : ✅ `http://digital-twin-influxdb:8086` (HTTP 204) + - Orion-LD : ✅ `http://fiware-gis-quickstart-orionproxy-1:80` (HTTP 200) + - FROST : ⚠️ `http://frost-api-8090:8080` (HTTP 400) + - Stellio : ✅ `http://stellio-api-gateway:8080` (HTTP 404) +3. ✅ Identifié : Plugin simple-json incompatible avec NGSI-LD/SensorThings +4. ✅ Documenté solutions (A/B/C ci-dessus) + +## 📋 Prochaines étapes (pour reprendre plus tard) +1. **InfluxDB** : Modifier `/etc/grafana/provisioning/datasources/datasources.yml` : + ```yaml + - name: InfluxDB-SmartCity + type: influxdb + url: http://digital-twin-influxdb:8086 + jsonData: + version: Flux + organization: smartcity + defaultBucket: smartcity + secureJsonData: + token: "" + ``` +2. **Orion-LD/FROST/Stellio** : Choisir Option B ou C (adaptateur ou HTTP direct) +3. **Tester avec panels réels** (pas seulement health check API) + +## 🎯 Pourquoi Prometheus marche ? +- Plugin **natif** Grafana (codé en Go) +- Communication directe protocole Prometheus +- Réseau partagé `smartcity-shared` avec Grafana + +--- +*Session du 05-05-2026 : 10+ tentatives de fix Grafana datasources* +*Problème identifié : simple-json plugin incompatible + InfluxDB read-only* +*Solution : Voir Options A/B/C ci-dessus*