zstatus.sh checks the status of each zpool on the system and will send an email if all pools are not healthy. The check can be automated by adding the script to crontab.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# zstatus.sh | |
# | |
# Check pool status. | |
# | |
EMAIL="test@somewhere.com" | |
HOSTNAME="$(hostname)" | |
# Linux | |
STATUS="$(/sbin/zpool status -x)" | |
# illumos | |
#STATUS="$(/usr/sbin/zpool status -x)" | |
echo "${STATUS}" | grep -qe "all pools are healthy" | |
if [ $? = 1 ]; then | |
echo "${STATUS}" | mail -s "ERROR: degraded pool on ${HOSTNAME}" ${EMAIL} | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment