- Création de la structure grafana/ par module et projet - Dashboards spécifiques pour Bitcoin, SDK Storage, SDK Signer, LeCoffre - Configuration des providers Grafana par module - Documentation complète du monitoring par module - Ajout de la surveillance 4NK IA Back API dans Prometheus - Organisation des dashboards en dossiers spécialisés - Mise à jour de la documentation monitoring principale Structure ajoutée: - modules/*/grafana/dashboards/ (dashboards par module) - modules/*/grafana/conf/ (configuration spécifique) - projects/*/grafana/dashboards/ (dashboards par projet) - docs/MONITORING_MODULES.md (guide détaillé) Dashboards créés: - Bitcoin Node Monitoring - SDK Storage Monitoring - SDK Signer Monitoring - LeCoffre Frontend Monitoring
253 lines
6.5 KiB
Markdown
253 lines
6.5 KiB
Markdown
# Monitoring par Module - 4NK Node
|
|
|
|
## Vue d'ensemble
|
|
|
|
Chaque module et projet dispose maintenant de sa propre structure de monitoring avec des dashboards spécifiques organisés dans Grafana Central.
|
|
|
|
## Structure des dossiers
|
|
|
|
### Modules avec monitoring dédié
|
|
|
|
```
|
|
modules/
|
|
├── bitcoin/
|
|
│ └── grafana/
|
|
│ ├── dashboards/
|
|
│ │ └── bitcoin-monitoring.json
|
|
│ └── conf/
|
|
│ └── (configuration spécifique si nécessaire)
|
|
├── sdk_storage/
|
|
│ └── grafana/
|
|
│ ├── dashboards/
|
|
│ │ └── sdk-storage-monitoring.json
|
|
│ └── conf/
|
|
├── sdk_signer/
|
|
│ └── grafana/
|
|
│ ├── dashboards/
|
|
│ │ └── sdk-signer-monitoring.json
|
|
│ └── conf/
|
|
├── sdk_relay1/
|
|
│ └── grafana/
|
|
│ ├── dashboards/
|
|
│ └── conf/
|
|
├── sdk_relay2/
|
|
│ └── grafana/
|
|
│ ├── dashboards/
|
|
│ └── conf/
|
|
├── sdk_relay3/
|
|
│ └── grafana/
|
|
│ ├── dashboards/
|
|
│ └── conf/
|
|
├── ihm_client/
|
|
│ └── grafana/
|
|
│ ├── dashboards/
|
|
│ └── conf/
|
|
├── tor/
|
|
│ └── grafana/
|
|
│ ├── dashboards/
|
|
│ └── conf/
|
|
└── blindbit-oracle/
|
|
└── grafana/
|
|
├── dashboards/
|
|
└── conf/
|
|
```
|
|
|
|
### Projets avec monitoring dédié
|
|
|
|
```
|
|
projects/
|
|
└── lecoffre/
|
|
├── lecoffre-front/
|
|
│ └── grafana/
|
|
│ ├── dashboards/
|
|
│ │ └── lecoffre-front-monitoring.json
|
|
│ └── conf/
|
|
└── lecoffre-back/
|
|
└── grafana/
|
|
├── dashboards/
|
|
└── conf/
|
|
```
|
|
|
|
## Organisation dans Grafana Central
|
|
|
|
### Dossiers de dashboards
|
|
|
|
- **4NK Global** : Dashboards généraux du système
|
|
- **Bitcoin Module** : Monitoring spécifique au nœud Bitcoin
|
|
- **SDK Storage Module** : Monitoring du service de stockage SDK
|
|
- **SDK Signer Module** : Monitoring du service de signature SDK
|
|
- **LeCoffre Frontend** : Monitoring de l'interface LeCoffre
|
|
- **Infrastructure** : Dashboards d'infrastructure
|
|
- **System** : Dashboards système
|
|
|
|
### Dashboards disponibles
|
|
|
|
#### Bitcoin Module
|
|
- **Bitcoin Node Monitoring** : Statut et logs du nœud Bitcoin
|
|
- Statut du service (up/down)
|
|
- Logs en temps réel
|
|
- Métriques de performance
|
|
|
|
#### SDK Storage Module
|
|
- **SDK Storage Monitoring** : Surveillance du service de stockage
|
|
- Statut du service
|
|
- Logs d'opérations
|
|
- Métriques de stockage
|
|
|
|
#### SDK Signer Module
|
|
- **SDK Signer Monitoring** : Surveillance du service de signature
|
|
- Statut du service
|
|
- Logs de signatures
|
|
- Métriques de performance
|
|
|
|
#### LeCoffre Frontend
|
|
- **LeCoffre Frontend Monitoring** : Surveillance de l'interface
|
|
- Statut du service
|
|
- Logs d'interface
|
|
- Métriques utilisateur
|
|
|
|
## Configuration
|
|
|
|
### Ajout d'un nouveau dashboard pour un module
|
|
|
|
1. **Créer le dashboard** :
|
|
```bash
|
|
# Créer le dossier si nécessaire
|
|
mkdir -p modules/[module-name]/grafana/dashboards/
|
|
|
|
# Créer le fichier JSON du dashboard
|
|
touch modules/[module-name]/grafana/dashboards/[module-name]-monitoring.json
|
|
```
|
|
|
|
2. **Ajouter la configuration dans Grafana Central** :
|
|
- Modifier `modules/grafana-central/conf/dashboards.yml`
|
|
- Ajouter un nouveau provider pour le module
|
|
|
|
3. **Copier le dashboard vers Grafana Central** :
|
|
```bash
|
|
# Créer le dossier de destination
|
|
mkdir -p modules/grafana-central/dashboards/[module-name]/
|
|
|
|
# Copier le dashboard
|
|
cp modules/[module-name]/grafana/dashboards/[module-name]-monitoring.json \
|
|
modules/grafana-central/dashboards/[module-name]/
|
|
```
|
|
|
|
4. **Redémarrer Grafana Central** :
|
|
```bash
|
|
docker-compose restart grafana-central.local
|
|
```
|
|
|
|
### Structure d'un dashboard JSON
|
|
|
|
```json
|
|
{
|
|
"dashboard": {
|
|
"id": null,
|
|
"title": "Module Name Monitoring",
|
|
"tags": ["4nk", "module-type", "specific-tag"],
|
|
"style": "dark",
|
|
"timezone": "browser",
|
|
"panels": [
|
|
{
|
|
"id": 1,
|
|
"title": "Service Status",
|
|
"type": "stat",
|
|
"targets": [
|
|
{
|
|
"expr": "up{job=\"4nk-module-name\"}",
|
|
"legendFormat": "Module Name"
|
|
}
|
|
],
|
|
"fieldConfig": {
|
|
"defaults": {
|
|
"color": {
|
|
"mode": "thresholds"
|
|
},
|
|
"thresholds": {
|
|
"steps": [
|
|
{
|
|
"color": "red",
|
|
"value": 0
|
|
},
|
|
{
|
|
"color": "green",
|
|
"value": 1
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"time": {
|
|
"from": "now-1h",
|
|
"to": "now"
|
|
},
|
|
"refresh": "30s"
|
|
}
|
|
}
|
|
```
|
|
|
|
## Maintenance
|
|
|
|
### Mise à jour des dashboards
|
|
|
|
1. **Modifier le dashboard local** dans `modules/[module]/grafana/dashboards/`
|
|
2. **Copier vers Grafana Central** :
|
|
```bash
|
|
cp modules/[module]/grafana/dashboards/[dashboard].json \
|
|
modules/grafana-central/dashboards/[module]/
|
|
```
|
|
3. **Redémarrer Grafana Central** :
|
|
```bash
|
|
docker-compose restart grafana-central.local
|
|
```
|
|
|
|
### Sauvegarde des dashboards
|
|
|
|
```bash
|
|
# Sauvegarde de tous les dashboards
|
|
tar -czf dashboards-backup-$(date +%Y%m%d).tar.gz \
|
|
modules/*/grafana/dashboards/ \
|
|
projects/*/grafana/dashboards/ \
|
|
modules/grafana-central/dashboards/
|
|
```
|
|
|
|
### Restauration des dashboards
|
|
|
|
```bash
|
|
# Restauration
|
|
tar -xzf dashboards-backup-YYYYMMDD.tar.gz
|
|
docker-compose restart grafana-central.local
|
|
```
|
|
|
|
## Bonnes pratiques
|
|
|
|
### Naming convention
|
|
- **Dashboards** : `[module-name]-monitoring.json`
|
|
- **Tags** : Toujours inclure `4nk` comme premier tag
|
|
- **Titres** : Format "Module Name Monitoring"
|
|
|
|
### Organisation des panels
|
|
- **Panel 1** : Statut du service (stat)
|
|
- **Panel 2** : Logs du service (logs)
|
|
- **Panel 3+** : Métriques spécifiques selon le module
|
|
|
|
### Configuration des seuils
|
|
- **Vert** : Service opérationnel (value: 1)
|
|
- **Rouge** : Service arrêté (value: 0)
|
|
|
|
### Refresh rate
|
|
- **Dashboards critiques** : 10s
|
|
- **Dashboards standards** : 30s
|
|
- **Dashboards de debug** : 60s
|
|
|
|
## Évolutions futures
|
|
|
|
- **Dashboards automatiques** : Génération automatique depuis les métriques
|
|
- **Alertes par module** : Configuration d'alertes spécifiques
|
|
- **Templates** : Templates de dashboards réutilisables
|
|
- **Intégration CI/CD** : Déploiement automatique des dashboards
|
|
- **Multi-tenant** : Séparation des dashboards par environnement
|