bundles/zfs/files/check_zpool_online: refactor
This commit is contained in:
parent
e897ef6898
commit
8b6acf7791
1 changed files with 7 additions and 5 deletions
|
@ -1,16 +1,18 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
for pool in $(zpool get name -H -o value)
|
for result in "$(zpool list -H -o name,health tank)"
|
||||||
do
|
do
|
||||||
status=$(zpool get health -H -o value $pool)
|
name=$(cut -f1 <<< $result)
|
||||||
if [ "$status" != ONLINE ]
|
health=$(cut -f2 <<< $result)
|
||||||
|
|
||||||
|
if [ "$health" != ONLINE ]
|
||||||
then
|
then
|
||||||
errors="$error\"$pool\" status is $status\n"
|
errors="$errors\"$name\" health is \"$health\"\n"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$errors" != "" ]
|
if [ "$errors" != "" ]
|
||||||
then
|
then
|
||||||
echo "CRITICAL - $errors"
|
echo $errors
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue