Skip to content

Commit 1c379a8

Browse files
committed
If gluster reports that it have unsynced entries, the script emits
warnings to stderr: " line 164: [: ==: unary operator expected". This is because "ex_stat" was unset from "heal"-check. Added a "ex_stat" to healcheck, and put ${ex_stat} in quotes for proper syntax.
1 parent 0770628 commit 1c379a8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

check_glusterfs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ for entries in $(sudo gluster volume heal ${VOLUME} info | awk '/^Number of entr
9292
done
9393
if [ "$heal" -gt 0 ]; then
9494
errors=("${errors[@]}" "$heal unsynched entries")
95+
ex_stat="WARNING_stat"
9596
fi
9697

9798
# get volume status
@@ -147,7 +148,7 @@ if [ -n "$CRIT" -a -n "$WARN" ]; then
147148
Exit UNKNOWN "critical threshold below warning"
148149
elif [ $freegb -lt $CRIT ]; then
149150
errors=("${errors[@]}" "free space ${freegb}GB")
150-
ex_stat="CRITICAL_stat"
151+
ex_stat="CRITICAL_stat"
151152
elif [ $freegb -lt $WARN ]; then
152153
errors=("${errors[@]}" "free space ${freegb}GB")
153154
ex_stat="WARNING_stat"
@@ -159,7 +160,7 @@ if [ -n "$errors" ]; then
159160
sep='; '
160161
msg=$(printf "${sep}%s" "${errors[@]}")
161162
msg=${msg:${#sep}}
162-
if [ ${ex_stat} == "CRITICAL_stat" ]; then
163+
if [ "${ex_stat}" == "CRITICAL_stat" ]; then
163164
Exit CRITICAL "${msg}"
164165
else
165166
Exit WARNING "${msg}"

0 commit comments

Comments
 (0)