Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #
- # Written by nka. Modified by Maurizio.
- # After debugging comment the next 2 lines, and the last one.
- #exec >>/var/log/zfscheck.log 2>&1
- #set -xu
- email=mail@example.com
- max_cap=80
- if ! zpool status -x | grep 'all pools are healthy' > /dev/null 2>&1; then
- { date; echo; hostname; echo; zpool status -xv; } | mail -s \
- "Disk failure in: $(hostname)" $email
- else
- cap=$(zpool list -H -o capacity | cut -d'%' -f1)
- for line in ${cap}; do
- if [ "$line" -gt $max_cap ]; then
- { date; echo; hostname; echo; zpool list -v; } \
- | mail -s "Disk capacity exceed $max_cap% in: $(hostname)" \
- $email
- break
- fi
- done
- fi
- #set +xu
Add Comment
Please, Sign In to add comment