33800 Docs

← Retour

Task : Audit Dashboard Dynamique - Phase 2

Date : 13/01/2026 13:26 Duree : ~30 min Statut : TERMINE


Objectif

Identifier toutes les valeurs hardcodees dans les scripts generate.d/ du dashboard monitoring.


Resultats de l'Audit

Resume par Script

Script Taille Hardcoding Priorite Migration Effort
_common.sh 5KB ELEVE P1 S
01-index.sh 73KB MOYEN P2 M
02-alerts.sh 8KB FAIBLE P3 XS
03-doc.sh 41KB TRES ELEVE P1 L
04-secrets.sh 13KB TRES ELEVE P1 M
05-endpoints.sh 63KB TRES ELEVE P1 L
06-montages.sh 7KB FAIBLE P3 XS
07-nginx.sh 14KB FAIBLE P3 XS
08-crons.sh 39KB MOYEN P2 M
09-architecture.sh 20KB OK - -
12-raidz.sh 19KB FAIBLE P3 XS
13-models.sh 10KB MOYEN P2 S
14-syncthing.sh 5KB MOYEN P2 S

Detail par Script

_common.sh (P1 - PRIORITAIRE)

Probleme central : IP nginx hardcodee dans deploy_page()

local nginx_host="192.168.1.104"

Footer hardcode dans gen_footer_full():

Solution : Creer un fichier config.json avec:


01-index.sh (P2)

Hardcoding trouve :

Deja dynamique :

Solution : Generer sections serveurs depuis JSON comme fait pour architecture.html


02-alerts.sh (P3 - FAIBLE)

Hardcoding :

Note : Logique d'alertes basee sur JSON, peu de hardcoding


03-doc.sh (P1 - CRITIQUE)

Hardcoding massif (~60 occurrences):

Solution :


04-secrets.sh (P1 - CRITIQUE)

Hardcoding (~30 occurrences):

Securite : Ce fichier contient des infos sensibles, migration vers JSON risquee

Solution recommandee : Garder statique, MAJ manuelle


05-endpoints.sh (P1 - CRITIQUE)

Hardcoding massif (~80 occurrences):

Solution : Fichier services.json avec:

{
  "ollama": { "host": "win11", "port": 11434, "url": null },
  "redis-prod": { "host": "prod-portainer", "port": 6379, "url": null },
  "grafana": { "host": "prod-portainer", "port": 3000, "url": "grafana.33800" }
}

06-montages.sh (P3)

Hardcoding faible :

Deja dynamique : Montages lus depuis current.json


07-nginx.sh (P3)

Hardcoding faible :

Deja dynamique : Sites nginx depuis collecte SSH


08-crons.sh (P2)

Hardcoding moyen (~15 occurrences):

Deja dynamique : Status crons depuis current.json


12-raidz.sh (P3)

Hardcoding faible :

Deja dynamique : Donnees ZFS depuis current.json


13-models.sh (P2)

Hardcoding moyen (~10 occurrences):

Solution : Lire config Ollama depuis JSON


14-syncthing.sh (P2)

Hardcoding moyen :

Solution : Lire depuis current.json


Plan de Migration Recommande

Phase 3A - Centralisation Config (Effort: S)

  1. Creer /stock_8to/33800-stack/monitoring/config.json:

    {
    "hosts": {
     "pve": { "ip": "192.168.1.10", "ip_storage": "10.10.10.10", "mdns": "pve.local" },
     "proxmox1": { "ip": "192.168.1.155", "mdns": "proxmox.local" },
     "prod-portainer": { "ip": "192.168.1.12", "mdns": "prod-portainer.local" },
     "nginx": { "ip": "192.168.1.104", "mdns": "nginx.local" }
    },
    "services": {
     "portainer_prod": { "host": "prod-portainer", "port": 9443, "https": true },
     "grafana": { "host": "prod-portainer", "port": 3000, "domain": "grafana.33800" }
    }
    }
  2. Modifier _common.sh pour lire nginx_host depuis config.json

  3. Modifier gen_footer_full() pour generer liens depuis config.json

Phase 3B - Migration Progressive (Effort: M-L)

Priorite 1 : Scripts a fort impact

Priorite 2 : Scripts a impact moyen

Priorite 3 : Garder statique (documentation)


Effort Total Estime

Phase Description Effort
3A config.json + _common.sh 2h
3B-P1 01-index.sh dynamique 3h
3B-P2 crons + models + syncthing 2h
3B-P3 (statique - pas de migration) 0h
4 Script verification 1h

Total : ~8h (1 journee)


Recommandations

  1. Commencer par config.json : Centralise les IPs = impact sur tous les scripts
  2. Ne pas migrer 03-doc, 04-secrets, 05-endpoints : Documentation statique, MAJ rare
  3. Accepter le hardcoding partiel : 100% dynamique n'est pas toujours necessaire
  4. Tester apres chaque modification : ./generate.sh + verification visuelle

Fichiers de Reference