bundlewrap/bundles/zfs/files/check_zpool_online

16 lines
313 B
Text
Raw Normal View History

#!/bin/bash
if [ $# -eq 0 ] ; then
echo "Please provide pool name as first argument, e.g. 'tank'."
exit 3
fi
if [ "$(zpool status "$1" | grep '^ state:')" = ' state: ONLINE' ]
then
echo "OK - Pool '$1' is online"
exit 0
else
echo "CRITICAL - Pool '$1' is FAULTY or NOT ONLINE"
exit 2
fi