Skip to content

Instantly share code, notes, and snippets.

@russianryebread
Created December 26, 2012 17:25
Show Gist options
  • Save russianryebread/4381624 to your computer and use it in GitHub Desktop.
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.
#!/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