Proposition : Script d'Audit Complet de la Stack
Date : 12/01/2026 13:47
Status : IMPLEMENTEE
Objectif : Detecter toutes les incoherences entre Realite / Dashboard / Documentation
Principe
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ REALITE │ │ DASHBOARD │ │ DOCS │
│ (systemes) │ │ (JSON/HTML) │ │ (CLAUDE.md) │
└──────┬──────┘ └──────┬──────┘ └──────┬──────┘
│ │ │
└───────────────────┼───────────────────┘
│
┌──────▼──────┐
│ AUDIT.SH │
│ Compare 3 │
│ sources │
└──────┬──────┘
│
┌──────▼──────┐
│ RAPPORT │
│ Ecarts + │
│ Severite │
└─────────────┘
Structure du script
/stock_8to/33800-stack/monitoring/
├── audit.sh # Script principal
├── audit.d/ # Modules par categorie
│ ├── 01-servers.sh # IPs, ping, status
│ ├── 02-zfs.sh # Pools, usage, scrub
│ ├── 03-docker.sh # Containers, ports, images
│ ├── 04-services.sh # Endpoints, health
│ ├── 05-nginx.sh # Configs vs containers actifs
│ ├── 06-crons.sh # Schedules, derniers runs
│ ├── 07-nfs.sh # Montages, IPs reseau
│ ├── 08-docs.sh # Coherence CLAUDE.md/STATUS.md
│ └── 09-secrets.sh # Fichiers env, coherence PROD/DEV
└── audit-report.json # Sortie structuree
Categorisation des checks
1. SERVERS (01-servers.sh)
| Check |
Realite |
Dashboard |
Doc |
| PVE IP principale |
hostname -I |
servers.pve.ip |
CLAUDE.md section IPs |
| PVE IP alias NFS |
ip addr show |
- |
CLAUDE.md |
| prod-portainer IP |
SSH hostname -I |
servers["docker-prod"].ip |
CLAUDE.md |
| dev-portainer IP |
SSH hostname -I |
servers["dev-portainer"].ip |
CLAUDE.md |
| gitlab IP |
SSH hostname -I |
servers.gitlab.ip |
CLAUDE.md |
| nginx IP |
SSH hostname -I |
servers.nginx.ip |
CLAUDE.md |
| jellyfin IP |
SSH hostname -I |
servers.jellyfin.ip |
CLAUDE.md |
| win11 IP |
SSH hostname |
servers.win11.ip |
CLAUDE.md |
| proxmox1 IP |
SSH hostname -I |
servers.proxmox1.ip |
CLAUDE.md |
2. ZFS (02-zfs.sh)
| Check |
Realite |
Dashboard |
Doc |
| stock_8to state |
zpool status |
servers.pve.zfs.stock_8to.state |
- |
| stock_8to usage |
zfs list |
servers.pve.zfs.stock_8to.percent |
- |
| stock_36to state |
zpool status |
servers.pve.raidz.stock_36to |
- |
| stock_1to state |
SSH proxmox1 zpool status |
servers.proxmox1.zfs |
- |
| win_hdd (existe?) |
zpool list |
servers.pve.zfs.win_hdd |
- |
3. DOCKER (03-docker.sh)
| Check |
Realite |
Dashboard |
Doc |
| PROD containers count |
SSH docker ps -q \| wc -l |
servers["docker-prod"].containers.running |
- |
| PROD container list |
SSH docker ps --format |
servers["docker-prod"].containers.list |
- |
| PROD ports exposes |
SSH docker ps --format {{.Ports}} |
container.port dans JSON |
- |
| DEV containers count |
SSH docker ps -q \| wc -l |
servers["dev-portainer"].containers.running |
- |
| DEV container list |
SSH docker ps --format |
servers["dev-portainer"].containers.list |
- |
| Registry images |
curl registry:5000/v2/_catalog |
- |
- |
| daemon.json PROD |
SSH cat /etc/docker/daemon.json |
- |
CLAUDE.md |
| daemon.json DEV |
SSH cat /etc/docker/daemon.json |
- |
CLAUDE.md |
4. SERVICES (04-services.sh)
| Check |
Realite |
Dashboard |
Doc |
| ollama status |
curl win11:11434/api/tags |
services.ollama.status |
- |
| redis_prod status |
redis-cli ping |
services.redis_prod.status |
- |
| redis_dev status |
redis-cli ping |
services.redis_dev.status |
- |
| supabase_prod status |
curl :8200/health |
services.supabase_prod.status |
- |
| supabase_dev status |
curl :8100/health |
services.supabase_dev.status |
- |
| whisper status |
curl :9100/health |
services.whisper.status |
- |
| yolo status |
curl :9200/health |
services.yolo.status |
- |
| needfinder status |
curl :5200/health |
services.needfinder.status |
- |
| notif_logger status |
curl :5300/health |
services.notif_logger.status |
- |
5. NGINX (05-nginx.sh)
| Check |
Realite |
Dashboard |
Doc |
| Config count |
ls /etc/nginx/sites-enabled \| wc -l |
servers.nginx.configs |
- |
| Site X target |
grep proxy_pass config |
servers.nginx.sites[X].target |
- |
| Target accessible |
curl -s target |
- |
- |
| Container sur port |
SSH docker docker ps --filter publish=PORT |
- |
- |
Check special : Pour chaque site nginx, verifier que le target (IP:PORT) correspond a un container actif.
6. CRONS (06-crons.sh)
| Check |
Realite |
Dashboard |
Doc |
| monitoring cron |
crontab -l ou /etc/cron.d/ |
crons.monitoring |
CLAUDE.md |
| rsync cron |
/etc/cron.d/rsync-* |
crons.rsync_stock8 |
CLAUDE.md |
| gitlab backup cron |
SSH gitlab cat /etc/cron.d/gitlab-backup |
crons.gitlab_backup |
CLAUDE.md |
| Dernier backup gitlab |
ls -lt /mnt/gitlab-nfs/backups/ |
crons.gitlab_backup.last_run |
- |
7. NFS (07-nfs.sh)
| Check |
Realite |
Dashboard |
Doc |
| Exports PVE |
cat /etc/exports |
- |
CLAUDE.md |
| Mount prod-portainer |
SSH mount \| grep nfs |
servers["docker-prod"].mounts |
CLAUDE.md |
| Mount dev-portainer |
SSH mount \| grep nfs |
servers["dev-portainer"].mounts |
CLAUDE.md |
| IP reseau utilise |
mount output |
mounts dans JSON |
CLAUDE.md (10G vs 1G) |
8. DOCS (08-docs.sh)
| Check |
Source 1 |
Source 2 |
Action si ecart |
| IPs machines |
Realite |
CLAUDE.md |
MAJ CLAUDE.md |
| Ports services |
Realite |
CLAUDE.md |
MAJ CLAUDE.md |
| Services actifs |
Realite |
STATUS.md |
MAJ STATUS.md |
| GitLab version |
gitlab-rake gitlab:env:info |
CLAUDE.md |
MAJ CLAUDE.md |
| Containers PROD |
docker ps |
STATUS.md |
MAJ STATUS.md |
9. SECRETS (09-secrets.sh)
| Check |
Realite |
Dashboard |
Doc |
| prod.env existe |
ls /stock_8to/.../secrets/ |
- |
CLAUDE.md |
| dev.env existe |
ls /stock_8to/.../secrets/ |
- |
CLAUDE.md |
| Variables coherentes |
diff <keys> |
- |
- |
Format de sortie
audit-report.json
{
"timestamp": "2026-01-12T14:00:00Z",
"summary": {
"total_checks": 150,
"passed": 140,
"failed": 10,
"by_severity": {
"critical": 2,
"warning": 5,
"info": 3
}
},
"failures": [
{
"id": "servers.pve.ip",
"category": "servers",
"severity": "warning",
"description": "IP PVE dans JSON ne correspond pas",
"expected": "192.168.1.4",
"actual_reality": "192.168.1.4 192.168.1.10 10.10.10.10",
"actual_json": "192.168.1.10",
"actual_doc": "192.168.1.4 (+ .10 alias)",
"fix_suggestion": "Mettre a jour collect.sh pour utiliser IP principale"
},
{
"id": "nginx.site.n8n",
"category": "nginx",
"severity": "critical",
"description": "Site nginx pointe vers container inexistant",
"expected": "Container actif sur port 7676",
"actual_reality": "Aucun container sur ce port",
"actual_json": "target: 192.168.1.51:7676",
"actual_doc": "-",
"fix_suggestion": "Supprimer config nginx ou deployer container"
}
]
}
Rapport console (resume)
================================================================================
AUDIT STACK 33800 - 12/01/2026 14:00
================================================================================
SERVERS ............................................. [8/9 OK] 1 WARNING
ZFS ................................................. [5/5 OK]
DOCKER .............................................. [24/26 OK] 2 CRITICAL
SERVICES ............................................ [10/10 OK]
NGINX ............................................... [33/46 OK] 13 WARNING
CRONS ............................................... [4/4 OK]
NFS ................................................. [6/6 OK]
DOCS ................................................ [15/18 OK] 3 INFO
SECRETS ............................................. [2/2 OK]
--------------------------------------------------------------------------------
CRITICAL (2)
--------------------------------------------------------------------------------
[DOCKER] supabase_dev status=error mais DB ok - verifier collect.sh
[NGINX] n8n.33800.nowhere84.com -> 192.168.1.51:7676 (container inexistant)
--------------------------------------------------------------------------------
WARNING (14)
--------------------------------------------------------------------------------
[SERVERS] pve.ip=192.168.1.10 dans JSON, realite=192.168.1.4 (principal)
[NGINX] 13 configs pointent vers containers inexistants (voir liste)
...
--------------------------------------------------------------------------------
INFO (3)
--------------------------------------------------------------------------------
[DOCS] GitLab version: realite=18.7.0, doc=18.6.2
...
================================================================================
Details: /stock_8to/33800-stack/monitoring/audit-report.json
================================================================================
Execution
# Audit complet
/stock_8to/33800-stack/monitoring/audit.sh
# Audit une categorie
/stock_8to/33800-stack/monitoring/audit.sh --only servers
# Audit avec fix automatique (si possible)
/stock_8to/33800-stack/monitoring/audit.sh --fix
# Audit silencieux (juste JSON)
/stock_8to/33800-stack/monitoring/audit.sh --json-only
Integration
- Cron optionnel : Executer audit.sh apres collect.sh pour alerter si ecarts
- Page dashboard : audit.html avec derniers resultats
- Notification : Alert si CRITICAL detecte
Estimation effort
| Phase |
Description |
Effort |
| 1 |
Structure + modules 01-03 (servers, zfs, docker) |
2-3h |
| 2 |
Modules 04-06 (services, nginx, crons) |
2h |
| 3 |
Modules 07-09 (nfs, docs, secrets) |
1-2h |
| 4 |
Rapport JSON + console |
1h |
| 5 |
Tests + ajustements |
1h |
Total estime : 7-9h
Questions avant implementation
-
Severite : Comment classer ? Ma proposition :
- CRITICAL = service down ou config cassee
- WARNING = incoherence affichage mais service OK
- INFO = doc pas a jour
-
Fix auto : Quels ecarts corriger automatiquement ?
- MAJ STATUS.md ? (oui)
- MAJ CLAUDE.md ? (non, validation manuelle)
- Supprimer configs nginx orphelines ? (non, validation manuelle)
-
Frequence : Audit a chaque collect.sh ou manuel seulement ?
Validation requise
- [ ] Structure OK
- [ ] Checks couvrent tout
- [ ] Severites OK
- [ ] Questions repondues