33800 Docs

← Retour

Backlog : Alerting ZFS/RAID Automatique

Date ajout : 12/01/2026 Priorite : HAUTE Categorie : MONITORING Statut : TERMINE Date fin : 12/01/2026 Effort reel : 30min


Objectif

Recevoir des alertes automatiques en cas de probleme ZFS :


Pools a surveiller

Pool Machine Type Criticite
stock_8to PVE RAIDZ1 HAUTE (prod)
stock_36to PVE RAIDZ2 MOYENNE (backup)
stock_1to Proxmox 155 Mirror MOYENNE (dev)

Implementation proposee

Option 1 : Script cron + notif-logger

#!/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

Option 2 : ZED (ZFS Event Daemon)

Configurer /etc/zfs/zed.d/zed.rc pour envoyer des mails/notifications.


Cron suggere

# /etc/cron.d/zfs-alerts
0 */6 * * * root /usr/local/bin/zfs-alert.sh

Alertes a configurer

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

Dependances


Notes

Le dashboard affiche deja le status RAIDZ mais pas d'alerte proactive. Ce backlog ajoute la notification automatique.


IMPLEMENTATION (12/01/2026)

Scripts deployes

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)

Fonctionnalites

Test

# Mode test (pas d'envoi)
/usr/local/bin/zfs-alert.sh --test

# Execution reelle
sudo /usr/local/bin/zfs-alert.sh

Verification

# Voir logs
cat /var/log/zfs-alert.log

# Forcer execution
sudo /usr/local/bin/zfs-alert.sh