Date ajout : 12/01/2026 Priorite : HAUTE Categorie : MONITORING Statut : TERMINE Date fin : 12/01/2026 Effort reel : 30min
Recevoir des alertes automatiques en cas de probleme ZFS :
| Pool | Machine | Type | Criticite |
|---|---|---|---|
| stock_8to | PVE | RAIDZ1 | HAUTE (prod) |
| stock_36to | PVE | RAIDZ2 | MOYENNE (backup) |
| stock_1to | Proxmox 155 | Mirror | MOYENNE (dev) |
#!/bin/bash
# /usr/local/bin/zfs-alert.sh
# Verifier status pools
DEGRADED=$(zpool status | grep -c "DEGRADED\|FAULTED")
if [ "$DEGRADED" -gt 0 ]; then
curl -X POST "http://192.168.1.12:5300/api/notify/all" \
-H "Content-Type: application/json" \
-d '{"title":"ALERTE ZFS","body":"Pool DEGRADED detecte!","level":"critical"}'
fi
# Verifier espace
for pool in stock_8to stock_36to; do
USED=$(zfs get -H -o value capacity $pool | tr -d '%')
if [ "$USED" -gt 85 ]; then
curl -X POST "http://192.168.1.12:5300/api/notify/push" \
-H "Content-Type: application/json" \
-d "{\"title\":\"ZFS Espace\",\"body\":\"$pool a ${USED}% utilise\"}"
fi
done
Configurer /etc/zfs/zed.d/zed.rc pour envoyer des mails/notifications.
# /etc/cron.d/zfs-alerts
0 */6 * * * root /usr/local/bin/zfs-alert.sh
| Evenement | Niveau | Canal |
|---|---|---|
| Pool DEGRADED | CRITICAL | push + mail |
| Pool FAULTED | CRITICAL | push + mail |
| Scrub errors | WARNING | push |
| Espace > 85% | WARNING | push |
| Espace > 95% | CRITICAL | push + mail |
Le dashboard affiche deja le status RAIDZ mais pas d'alerte proactive. Ce backlog ajoute la notification automatique.
| Machine | Script | Cron |
|---|---|---|
| PVE | /usr/local/bin/zfs-alert.sh | /etc/cron.d/zfs-alerts (*/6h) |
| Proxmox 155 | /usr/local/bin/zfs-alert.sh | /etc/cron.d/zfs-alerts (*/6h) |
# Mode test (pas d'envoi)
/usr/local/bin/zfs-alert.sh --test
# Execution reelle
sudo /usr/local/bin/zfs-alert.sh
# Voir logs
cat /var/log/zfs-alert.log
# Forcer execution
sudo /usr/local/bin/zfs-alert.sh