Last active
July 5, 2018 08:26
-
-
Save ww898/77c04146591389609f2af6657bf6c458 to your computer and use it in GitHub Desktop.
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
#!/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