Created
December 26, 2012 17:25
-
-
Save russianryebread/4381624 to your computer and use it in GitHub Desktop.
Check the status of a ZFS pool and mail the admin it if it's not ok.
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 | |
# Emails the status of a FreeNAS ZFS RAID Array to the Admin. | |
ADMIN="[email protected]" | |
POOL="ZFS_POOL_NAME" | |
STATE=`zpool status $POOL | grep 'state:' | awk '{ print $2 }'` | |
if [ "$STATE" = "ONLINE" ]; then | |
exit 0 | |
else | |
zpool status $POOL | mail -s "$POOL ZFS Pool Status: $STATE!!!" $ADMIN | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment