Skip to content

Instantly share code, notes, and snippets.

@ww898
Last active July 5, 2018 08:26
Show Gist options
  • Save ww898/77c04146591389609f2af6657bf6c458 to your computer and use it in GitHub Desktop.
Save ww898/77c04146591389609f2af6657bf6c458 to your computer and use it in GitHub Desktop.
#!/bin/bash
txt=$(zpool status)
condition=$(echo "$txt" | egrep -i '(DEGRADED|FAULTED|OFFLINE|UNAVAIL|REMOVED|FAIL|DESTROYED|corrupt|cannot|unrecover)')
if [ "$condition" ]; then
echo "$txt" | mail -s "ZFS health failed" alarm.zfs@localhost
else
echo "$txt" | mail -s "ZFS health ok" info.zfs@localhost
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment