Skip to content

Instantly share code, notes, and snippets.

@Lukasa
Created August 6, 2012 19:54
Show Gist options
  • Save Lukasa/3277961 to your computer and use it in GitHub Desktop.
Save Lukasa/3277961 to your computer and use it in GitHub Desktop.
A script to test the health of ZFS pools.
#!/bin/bash
# This script checks the state of all zpools. If an error is found, it
# emails the contents of zpool status to the administrator.
mkdir -p ~/.zpool_status
cd ~/.zpool_status
result=`zpool status -x`
if [ "$result" == "all pools are healthy" ]; then
exit 0
else
zpool status > status.txt
send_email status.txt
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment