it-artikel:linux:proxmox-8-how-to-check-and-report-zpool-zraid-status-automatically
Proxmox 8 How to check and report zpool zraid status automatically
This is NOT Proxmox exclusive and will most likely work on any Debian based Linux distro using openZFS for zpools/raid that has been peoperly configured for sending SMTP Email.
- Prerequisits:
- System must have been configured to send SMTP EMail if send to “root” user.
- ZFS pools (raids) must already be in place
- Create a shell script for use in /etc/cron.hourly/ :
- /etc/cron.hourly/check-raid-status.sh
#!/bin/bash # CHANGE LOG: # # 2021-08-01 A.Werner ADD: wall + console output + new string # clean,checking # # 2021-09-05 A.Werner ADD: new OK string added # # 2025-04-26 A.Werner rework: for pve and zpools with email alert # # MAILTO=root SUBJ="$(hostname -s):RAID STATUS ALERT:" function dit { beep -f 750 -l 75 -d 50 } function dah { beep -f 750 -l 175 -d 50 } function spc { sleep .1 } function s { dit dit dit spc } function o { dah dah dah spc } function morse_sos { s o s sleep .5 } #set -x zpoolStatus=$( zpool status -x ) case "$zpoolStatus" in 'all pools are healthy') : # nop ;; *) morse_sos echo "$0 WARNING: zpool status -x reports status: '$zpoolStatus' on $(date)" >&2 echo "$0 WARNING: zpool status -x reports status: '$zpoolStatus' on $(date)" >/dev/console wall "$0 WARNING: zpool status -x reports status: '$zpoolStatus' on $(date)" echo "$0 WARNING: zpool status -x reports status: '$zpoolStatus' on $(date)" | mail -s "$SUBJ" "$MAILTO" ;; esac
- Make the shell script executable:
chmod -v +x /etc/cron.hourly/check-raid-status.sh
— Axel Werner 2025-04-26 16:19
it-artikel/linux/proxmox-8-how-to-check-and-report-zpool-zraid-status-automatically.txt · Last modified: 2025-04-26 16:44 by axel.werner.1973@gmail.com