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.
# | |
# 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