diff --git a/bundles/zfs/files/check_zpool_online b/bundles/zfs/files/check_zpool_online index da1f9a2..cb37848 100755 --- a/bundles/zfs/files/check_zpool_online +++ b/bundles/zfs/files/check_zpool_online @@ -1,16 +1,18 @@ #!/bin/bash -for pool in $(zpool get name -H -o value) +for result in "$(zpool list -H -o name,health tank)" do - status=$(zpool get health -H -o value $pool) - if [ "$status" != ONLINE ] + name=$(cut -f1 <<< $result) + health=$(cut -f2 <<< $result) + + if [ "$health" != ONLINE ] then - errors="$error\"$pool\" status is $status\n" + errors="$errors\"$name\" health is \"$health\"\n" fi done if [ "$errors" != "" ] then - echo "CRITICAL - $errors" + echo $errors exit 2 fi