Funk-lab/progress/2026-06-25.md
Claude 649c6fde8e
feat(monitoring): surveillance réseau active via blackbox_exporter
Sondes actives ICMP/HTTP/DNS qui complètent le monitoring passif
(node_exporter + up{}) : joignabilité hôtes/passerelle, accès internet,
santé DNS *.lab.local + forwarding, latence LAN, services de bout en
bout via Traefik.

- blackbox_exporter (chart 11.13.0, ArgoCD, ns monitoring) — ICMP via
  NET_RAW, DNS du pod = dnsmasq (chemin réel lab → Traefik)
- 3 jobs blackbox-icmp/-http/-dns (additionalScrapeConfigs)
- alerts-network.yaml : internet, DNS, passerelle, hôtes, services,
  latence, exporter (→ pipeline AlertManager existant)
- Asa : outil network_status + contexte présélectionnable reseau
- doc admin/infra/reseau.md + CLAUDE.md + progress

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rc3dLKfqEPHexvFCCx5ZEF
2026-06-25 12:43:13 +00:00

65 lines
3.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 2026-06-25 — Surveillance réseau active (blackbox_exporter) + outil Asa `network_status`
## Résumé
Ajout d'une **surveillance réseau active** au cluster : déploiement de **blackbox_exporter**
(chart Helm 11.13.0, ns `monitoring`, ArgoCD) qui exécute des **sondes ICMP / HTTP / DNS**.
Ça comble le trou laissé par le monitoring *passif* (node_exporter + `up{}`) : on mesure
désormais la **joignabilité** des hôtes et de la passerelle, l'**accès internet**, la **santé
DNS** (`*.lab.local` + forwarding) et la **latence LAN**, et on sonde les services **de bout
en bout** via Traefik.
Côté assistant, **Asa** gagne l'outil `network_status` (boucle agentique) et un contexte
présélectionnable `reseau`.
Développé hors-ligne (sans accès cluster) sur la branche `claude/gifted-feynman-qqiyvq`
à déployer via ArgoCD (k8s) + redéploiement du STT-server.
---
## blackbox_exporter (ArgoCD, ns monitoring)
- `k8s/apps-of-apps/apps/blackbox-exporter.yaml` — Application multi-source (chart
`prometheus-blackbox-exporter` 11.13.0 + `$values` repo), calquée sur `kube-prometheus-stack`.
- `k8s/infra/blackbox-exporter/values.yaml` — modules (`http_2xx`, `http_2xx_insecure`,
`icmp`, `dns_lab`, `dns_external`, `tcp_connect`), **ICMP via `NET_RAW`** (ns en PSS
privileged), ressources minimales (3264 Mi), `serviceMonitor`/`prometheusRule` off,
`fullnameOverride: blackbox-exporter` (service prévisible).
- **DNS du pod = dnsmasq** (`dnsPolicy: None` + `dnsConfig` 192.168.10.1, repli 1.1.1.1) →
les sondes HTTP `*.lab.local` empruntent le vrai chemin DNS lab → Traefik.
## Sondes (additionalScrapeConfigs)
`k8s/infra/monitoring/values.yaml` — 3 jobs avec relabeling standard `→` service blackbox :
- `blackbox-icmp` : 192.168.10.1/.11/.12/.13/.20 (`scope=lan`) + 1.1.1.1 / 9.9.9.9 (`scope=internet`)
- `blackbox-http` : `http://<service>.lab.local` (grafana, prometheus, alertmanager, argocd,
openwebui, n8n, ghostfolio, searxng, stt) — `scope=ingress`
- `blackbox-dns` : 192.168.10.1:53, module par cible (`dns_lab` = wildcard, `dns_external` = forwarding)
## Alertes
`k8s/infra/monitoring/alerts/alerts-network.yaml` (PrometheusRule, `release: kube-prometheus-stack`) :
`InternetDown`, `DnsLabResolutionFailed`, `DnsForwardingFailed`, `GatewayUnreachable`,
`ClusterHostUnreachable`, `ServiceEndpointDown`, `HighLanLatency`, `SlowServiceResponse`,
`BlackboxExporterDown`. Même pipeline AlertManager → webhook Hermes + n8n → Gmail.
## Asa — `network_status` + contexte `reseau`
- `stt/server/stt_server/sources.py``network_block()` : sondes OK/total, internet, DNS lab,
latence LAN max, liste des sondes en échec ; enregistré dans `_FETCHERS` (`network`).
- `stt/server/stt_server/tools.py` — outil `network_status` (réutilise `network_block`).
- `stt/server/stt_server/contexts.py``network_status` ajouté aux outils du contexte `asa` ;
nouveau contexte présélectionnable `reseau` (source `network`).
## Doc
- `admin/infra/reseau.md` — section « Surveillance réseau active — blackbox_exporter »
(architecture, métriques PromQL, alertes, vérifs, caveats firewall/ICMP).
- `CLAUDE.md` — bullet monitoring mis à jour.
## À vérifier au déploiement
- ICMP vers gpu-01 / compute : leur **firewall hôte** peut dropper l'echo-request (storage-01
l'accepte). Si `ClusterHostUnreachable` à tort, ouvrir l'ICMP depuis `192.168.10.0/24`.
- Sondes HTTP : services derrière auth / 3xx non suivis → ajuster module ou retirer la cible.
- Tests STT non exécutés ici (deps `httpx`/`pydantic` absentes de l'env) — code byte-compilé OK.