mirror of
https://github.com/Alkatrazz24/Funk-lab.git
synced 2026-07-08 19:04:42 +02:00
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
This commit is contained in:
parent
ebb2eec184
commit
649c6fde8e
11 changed files with 527 additions and 5 deletions
|
|
@ -167,3 +167,83 @@ ip -s link show enp6s0f3u2c2
|
|||
# Connexions actives
|
||||
ss -tnp
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Surveillance réseau active — blackbox_exporter
|
||||
|
||||
Sondes **actives** (ICMP / HTTP / DNS) qui complètent les métriques *passives* du
|
||||
node_exporter. Elles répondent aux questions que `up{}` ne couvre pas : *« a-t-on
|
||||
internet ? »*, *« dnsmasq résout-il encore *.lab.local ? »*, *« quelle latence sur le
|
||||
LAN ? »*, *« le service répond-il de bout en bout via Traefik ? »*.
|
||||
|
||||
### Architecture
|
||||
|
||||
```
|
||||
Prometheus (in-cluster)
|
||||
│ scrape /probe?target=…&module=… (jobs blackbox-icmp / -http / -dns)
|
||||
▼
|
||||
blackbox-exporter.monitoring.svc.cluster.local:9115 (ns monitoring)
|
||||
│ exécute la sonde réelle
|
||||
├── ICMP → 192.168.10.1/.11/.12/.13/.20, 1.1.1.1, 9.9.9.9
|
||||
├── HTTP → http://<service>.lab.local (DNS du pod = dnsmasq → Traefik)
|
||||
└── DNS → 192.168.10.1:53 (dns_lab : *.lab.local ; dns_external : forwarding)
|
||||
```
|
||||
|
||||
| Élément | Emplacement |
|
||||
|---|---|
|
||||
| Déploiement (ArgoCD, chart Helm 11.13.0) | `k8s/apps-of-apps/apps/blackbox-exporter.yaml` |
|
||||
| Config blackbox (modules, ICMP, DNS du pod) | `k8s/infra/blackbox-exporter/values.yaml` |
|
||||
| Cibles + relabeling | `k8s/infra/monitoring/values.yaml` (jobs `blackbox-*`) |
|
||||
| Alertes | `k8s/infra/monitoring/alerts/alerts-network.yaml` |
|
||||
| Outil vocal Asa `network_status` + contexte `reseau` | `stt/server/stt_server/{tools,sources,contexts}.py` |
|
||||
|
||||
> Le pod blackbox a `dnsPolicy: None` + `dnsConfig` pointant sur **dnsmasq (192.168.10.1)**
|
||||
> avec repli `1.1.1.1`. Conséquence : les sondes HTTP `*.lab.local` empruntent le **vrai**
|
||||
> chemin (DNS lab → Traefik), et une panne dnsmasq fait échouer les sondes lab mais **pas**
|
||||
> les sondes internet (qui retombent sur 1.1.1.1).
|
||||
|
||||
### Métriques clés (PromQL)
|
||||
|
||||
```promql
|
||||
probe_success{job=~"blackbox-.*"} # 1 = OK, 0 = échec
|
||||
probe_success{job="blackbox-icmp",scope="internet"} # accès internet (ancres)
|
||||
probe_success{job="blackbox-dns",module="dns_lab"} # dnsmasq résout *.lab.local ?
|
||||
probe_icmp_duration_seconds{scope="lan",phase="rtt"} # latence LAN (RTT)
|
||||
probe_http_status_code{job="blackbox-http"} # code HTTP renvoyé
|
||||
probe_duration_seconds{job="blackbox-http"} # temps de réponse service
|
||||
```
|
||||
|
||||
### Alertes (`alerts-network.yaml`)
|
||||
|
||||
`InternetDown` (crit) · `DnsLabResolutionFailed` (crit) · `DnsForwardingFailed` (warn) ·
|
||||
`GatewayUnreachable` (crit) · `ClusterHostUnreachable` (warn) · `ServiceEndpointDown` (warn) ·
|
||||
`HighLanLatency` (warn) · `SlowServiceResponse` (warn) · `BlackboxExporterDown` (crit).
|
||||
Elles partent dans le même pipeline AlertManager → webhook Hermes + n8n → Gmail.
|
||||
|
||||
### Vérifications après déploiement
|
||||
|
||||
```bash
|
||||
# Le pod tourne ?
|
||||
kubectl get pods -n monitoring -l app.kubernetes.io/name=prometheus-blackbox-exporter
|
||||
|
||||
# Cibles blackbox vues par Prometheus (doivent être UP, health=up)
|
||||
# prometheus.lab.local → Status → Targets → blackbox-icmp / -http / -dns
|
||||
|
||||
# Tester une sonde à la main depuis un pod du cluster
|
||||
kubectl run -n monitoring bb-test --rm -it --image=curlimages/curl --restart=Never -- \
|
||||
'curl -s "http://blackbox-exporter:9115/probe?target=1.1.1.1&module=icmp" | grep probe_success'
|
||||
```
|
||||
|
||||
### Caveats / points de vigilance
|
||||
|
||||
- **ICMP** nécessite la capability `NET_RAW` (activée dans `values.yaml`) — possible car la ns
|
||||
`monitoring` est en PodSecurity **privileged**.
|
||||
- **Pare-feu hôtes** : le ping vers `192.168.10.1` (storage-01) passe (la règle gateway accepte
|
||||
le LAN cluster), mais **gpu-01 / compute** peuvent **dropper l'ICMP** selon leur firewall hôte.
|
||||
Si `ClusterHostUnreachable` se déclenche alors que l'hôte est vivant, vérifier qu'il accepte
|
||||
l'echo-request depuis `192.168.10.0/24` (côté flannel, le trafic pod sort masqué en IP de nœud).
|
||||
- **Sondes HTTP** : un service derrière auth ou qui renvoie 3xx non suivi sortira en échec —
|
||||
ajuster le module (`valid_status_codes`) ou retirer la cible dans `monitoring/values.yaml`.
|
||||
- **Ajouter une cible** = éditer la liste `targets` du job concerné dans
|
||||
`k8s/infra/monitoring/values.yaml`, puis `git push` (ArgoCD resync ~3 min).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue