Skip to content

Commit 2786725

Browse files
committed
Merge branch 'emitor', customink#3
2 parents 7bbea6d + 01e18b0 commit 2786725

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

check_glusterfs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
# * Modified by Doug Wilson <[email protected]>
1010
# * includes carrillm’s fix to support TB sized volumes
1111
# * outputs all errors on a critical alarm, not just free space
12+
#
13+
# * 20/08/2014
14+
# * Modified by emitor
15+
# * fix the regular expresion where get the free space (it didn't work for me on centOS)
16+
# * fix OK status to print the free space as it is
1217

1318
# This Nagios script was written against version 3.3 & 3.4 of Gluster. Older
1419
# versions will most likely not work at all with this monitoring script.
@@ -114,7 +119,7 @@ while read -r line; do
114119
key=${field[@]:0:3}
115120
if [ "${key}" = "Disk Space Free" ]; then
116121
freeunit=${field[@]:4}
117-
free=${freeunit:0:-2}
122+
free=${freeunit:0:${#freeunit}-2}
118123
freeconvgb=`echo "($free*1024)" | bc`
119124
unit=${freeunit#$free}
120125
if [ "$unit" = "TB" ]; then
@@ -173,4 +178,4 @@ if [ -n "$errors" ]; then
173178
fi
174179

175180
# exit with no errors
176-
Exit OK "${bricksfound} bricks; free space ${freegb}GB"
181+
Exit OK "${bricksfound} bricks; free space ${freeunit}"

0 commit comments

Comments
 (0)