Files
proxmoxscripts/bin/checkLogReplica.sh
2026-01-21 11:03:33 +01:00

27 lines
996 B
Bash

#!/bin/bash
echo "------------------------------------------------------------"
echo " REPORT ERRORI REPLICA PROXMOX (Ultime 24 ore)"
echo "------------------------------------------------------------"
# Percorso dei log di replica
LOG_DIR="/var/log/pve/replicate"
if [ ! -d "$LOG_DIR" ]; then
echo "Errore: Directory log non trovata."
exit 1
fi
# Trova tutti i file di log modificati nelle ultime 24h che contengono "error" o "timeout"
find $LOG_DIR -mtime -1 -type f -name "*" | while read logfile; do
if grep -qiE "error|timeout|failed" "$logfile"; then
VMID=$(basename "$logfile")
LAST_ERR=$(grep -iE "error|timeout|failed" "$logfile" | tail -n 1)
TIMESTAMP=$(stat -c %y "$logfile" | cut -d'.' -f1)
echo "ID: $VMID | Ultimo Errore: $TIMESTAMP"
echo "Dettaglio: $LAST_ERR"
echo "------------------------------------------------------------"
fi
done
echo "Suggerimento: Controlla 'zpool iostat -v 5' durante il prossimo job."