check_glusterfs plugin error

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
msachikanta
Posts: 58
Joined: Tue Jan 03, 2012 2:35 am

check_glusterfs plugin error

Post by msachikanta »

Hi,

I am trying to monitor glusterfs volumes by check_glusterfs nagios plugin, I have downloaded the plugin from https://exchange.nagios.org/directory/P ... ks/details site.

When I am trying to execute the plugin, I am getting below error.

Code: Select all

[b][root@server01 libexec]#[/b] ./check_glusterfs -v VOL01 -n 2
./check_glusterfs: line 111: -2: substring expression < 0
WARNING: 27 unsynched entries; found 1 bricks, expected 2
when I tried with debugging the script, I got the followings:

Code: Select all

[b][root@server01 libexec]#[/b] sh -x check_glusterfs -v VOL01 -n 2
+ PATH=/sbin:/bin:/usr/sbin:/usr/bin
++ basename -- check_glusterfs
+ PROGNAME=check_glusterfs
++ echo check_glusterfs
++ sed -e 's,[\/][^\/][^\/]*$,,'
+ PROGPATH=check_glusterfs
+ REVISION=1.0.1
+ . /usr/local/nagios/libexec/utils.sh
++ STATE_OK=0
++ STATE_WARNING=1
++ STATE_CRITICAL=2
++ STATE_UNKNOWN=3
++ STATE_DEPENDENT=4
+ getopts v:n:w:c: opt
+ case $opt in
+ VOLUME=VOL01
+ getopts v:n:w:c: opt
+ case $opt in
+ BRICKS=2
+ getopts v:n:w:c: opt
+ '[' -z VOL01 -o -z 2 ']'
+ for cmd in basename bc awk sudo pidof gluster
+ type -p basename
+ for cmd in basename bc awk sudo pidof gluster
+ type -p bc
+ for cmd in basename bc awk sudo pidof gluster
+ type -p awk
+ for cmd in basename bc awk sudo pidof gluster
+ type -p sudo
+ for cmd in basename bc awk sudo pidof gluster
+ type -p pidof
+ for cmd in basename bc awk sudo pidof gluster
+ type -p gluster
+ pidof glusterd
+ pidof glusterfsd
+ heal=0
++ awk '/^Number of entries: /{print $4}'
++ sudo gluster volume heal VOL01 info
+ for entries in '$(sudo gluster volume heal ${VOLUME} info | awk '\''/^Number of entries: /{print $4}'\'')'
+ '[' 17 -gt 0 ']'
+ let 17
+ for entries in '$(sudo gluster volume heal ${VOLUME} info | awk '\''/^Number of entries: /{print $4}'\'')'
+ '[' 10 -gt 0 ']'
+ let 27
+ '[' 27 -gt 0 ']'
+ errors=("${errors[@]}" "$heal unsynched entries")
+ bricksfound=0
+ freegb=9999999
+ shopt -s nullglob
check_glusterfs: line 136: syntax error near unexpected token `<'
check_glusterfs: line 136: `done < <(sudo gluster volume status ${VOLUME} detail)'
Can someone please help me to resolve the issue..?

Thanks,
Sachikanta
Last edited by dwhitfield on Tue Nov 29, 2016 11:33 am, edited 1 time in total.
Reason: code blocks FTW
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_glusterfs plugin error

Post by dwhitfield »

What's the output of bash --version?

If you are running bash 4.1 or older, you are going to need to update. What OS and version are you using? The community can help you upgrade, if you need it. Thanks!
msachikanta
Posts: 58
Joined: Tue Jan 03, 2012 2:35 am

Re: check_glusterfs plugin error

Post by msachikanta »

Thanks for your response.

Bash Version:
[root@server01 libexec]# bash --version
GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>


OS Release is: CentOS release 6.8 (Final), 2.6.32-642.6.1.el6.x86_64

I checked, bash is running latest version in my server. When I tried to execute it again I got the following error.

[root@server01 libexec]# ./check_glusterfs -v VOL1 -n 1
./check_glusterfs: line 111: -2: substring expression < 0
OK: 1 bricks; free space 9999999GB


I hope output is not correct as my gluster volume VOL01 is having total 786 GB. Please help.

Regards,
Sachikanta
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_glusterfs plugin error

Post by dwhitfield »

msachikanta wrote:GNU bash, version 4.1.2(1)
This is the problem. You either need to upgrade bash (compile it yourself, get another repo, or upgrade CentOS), or rewrite the plugin to work with bash 4.1. The version of bash that comes with CentOS 7 is 4.2.

We can go in either direction you like, but personally, I would suggest upgrading to CentOS 7. The reason for this suggestion is that it is the only way you get to stay on standard everything. Plus, eventually you'll have to move away from CentOS 6 anyway.

Please be advised that the upgrade process from CentOS 6 to 7 is not pretty: https://www.centos.org/forums/viewtopic.php?t=53678

Please let us know how you'd like to proceed.
msachikanta
Posts: 58
Joined: Tue Jan 03, 2012 2:35 am

Re: check_glusterfs plugin error

Post by msachikanta »

Thanks a lot for your help and advise..

But unfortunately now we cannot upgrade our OS release from 6 to 7 since all are in production.

For now I will write a custom script to monitor the gluster volumes and space. Later point of time when we really need to upgrade our OS after getting approval from our Management team, will do the upgrade and use this script.

Regards,
Sachikanta
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_glusterfs plugin error

Post by dwhitfield »

msachikanta wrote: For now I will write a custom script to monitor the gluster volumes and space.
You may not need to write a complete new script. This github issue was posted after the exchange update: https://github.com/customink/nagios-nrp ... s/issues/4. You might also try emailing the developer. Note that that is not our github.

If you do write a new script or a patch for the script, if you could post it here or to the exchange (or both), that would be a great help to the community.
Locked