Page 1 of 1

Monitoring Open-E Volume Groups

Posted: Wed Mar 07, 2018 5:02 pm
by ipcsysadmins
Hi,

I'm currently in the process of migrating plugins for Open-E to our new XI server and having an issue with a volume group check.

Distro/release: CentOS 7.4.1708
Processor: x86_64
NagiosXI Installation: Manual

I have the plugin installed, have a command configured, & service created. I can run the check from the NagiosXI server CLI, however, I cannot get output in the NagiosXI GUI when I "Run Command".

The command:

Code: Select all

check_opene_volumeusage	$USER1$/check_opene_volumeusage $ARG1$
The actual script:

Code: Select all

VOLPERCENT=`ssh -i /usr/local/nagios/libexec/$1.key -2 -p 22223 -l api $1 volume_status | grep "lvGeneralUseGroup00;NAS" | cut -d ";" -f 6`
PERCENT=${VOLPERCENT%.*}
if [ "$PERCENT" -gt 79 ]; then
echo "Critical - Volume Usage: $VOLPERCENT%"
exit 2
elif [ "$PERCENT" -gt 59 ]; then
echo "Warning - Volume Usage: $VOLPERCENT%"
exit 1
else
echo "OK - Volume Usage: $VOLPERCENT%"
exit 0
fi
CLI output when supplied with an arguments:

OK - Volume Usage: 24.65%

Now from the GUI, when I run the service check with the exact same argument:

OK - Volume Usage: %

Its the equivalent of running the check at the CLI while not selecting any volume groups. Does anyone know why the float is not returned in the GUI output?

Re: Monitoring Open-E Volume Groups

Posted: Wed Mar 07, 2018 5:58 pm
by scottwilkerson
In debugging these types of things in the past I have noted that the nagios user doesn't have the same environment as your user at the CLI and you may need the full paths for programs (like cut & grep), but in this case it could even be the shell.

I see a lack of shebang at the top, and your shell may be bash while the nagios users shell may be sh

Re: Monitoring Open-E Volume Groups

Posted: Thu Mar 08, 2018 10:29 am
by ipcsysadmins
Scott,

Thanks for replying, it gave me some ideas where to start. After taking a look at the nagios user, the shell is /sbin/nologin which is fine, but after switching it over to /bin/bash to run the script from the CLI and I received:

Host key verification failed.
Host key verification failed.
Host key verification failed.
Host key verification failed.
/usr/local/nagios/libexec/check_opene_volumeusage: line 6: [: : integer expression expected
/usr/local/nagios/libexec/check_opene_volumeusage: line 9: [: : integer expression expected
OK - Volume Usage: %

I knew the shebang was not the issue because the script executed, so I messed with permissions to see if that was the case, and double checked the env (which was correctly set), however these options did not fix the end result. I ended up prefixing sudo to each of the commands and the script worked. I've switched the nagios user shell back to /sbin/nologin and reset the permissions on the files/keys, now the correct percentage of volume usage is presented in the XI GUI.

Re: Monitoring Open-E Volume Groups

Posted: Thu Mar 08, 2018 10:34 am
by scottwilkerson
Excellent! Glad you were able to work through it