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