Skip to content

Instantly share code, notes, and snippets.

@wkettler
Last active December 30, 2015 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wkettler/7868106 to your computer and use it in GitHub Desktop.
Save wkettler/7868106 to your computer and use it in GitHub Desktop.
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