Page 2 of 2

Re: Nagios return 0byte string from bash script

Posted: Wed Jun 13, 2018 9:29 pm
by raja2206
Hi,

I hope, script is fine, because I can get output, if I run from CLI, but nagios is not able to execute the command with proper way.

there is no permission issue.

Any suggestion ?

Re: Nagios return 0byte string from bash script

Posted: Thu Jun 14, 2018 8:45 am
by scottwilkerson
Make sure all the commands in the underlying scripts (/opt/emc/uemcli/bin/uemcli.sh) have full paths to their files.

The nagios when running the commands isn't going to have the same PATH information so make sure any programs called have their full path

Re: Nagios return 0byte string from bash script

Posted: Mon Jun 18, 2018 4:23 am
by raja2206
Hi,

I have full permission for the commands and also I am using the same full path command in shell script.

# ls -la /opt/emc/uemcli/bin/uemcli.sh
-rwxrwxrwx 1 nagios nagios 300 Jan 16 00:12 /opt/emc/uemcli/bin/uemcli.sh

in script : ucli=/opt/emc/uemcli/bin/uemcli.sh

Re: Nagios return 0byte string from bash script

Posted: Mon Jun 18, 2018 12:52 pm
by scottwilkerson
But what about the contents of the script at /opt/emc/uemcli/bin/uemcli.sh ? does it contain a full path to all of the binaries and scripts it calls?

Re: Nagios return 0byte string from bash script

Posted: Tue Jun 19, 2018 4:33 am
by raja2206
Hi,

Inside the script have command, which is also have nagios permission,
# ls -la uemcli
lrwxrwxrwx 1 nagios nagios 29 Mar 8 14:35 uemcli -> /opt/emc/uemcli/bin/uemcli.sh
# ls -la /opt/emc/uemcli/bin/uemcli
-rwxrwxrwx 1 nagios nagios 2948695 Jan 16 00:12 /opt/emc/uemcli/bin/uemcli


# more /opt/emc/uemcli/bin/uemcli.sh
#!/bin/sh
UEMCLI_INSTALL_PATH=/opt/emc/uemcli
export UEMCLI_INSTALL_PATH
LD_LIBRARY_PATH=$UEMCLI_INSTALL_PATH/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
CMDLINE_STRING=
for i in "$@"; do
CMDLINE_STRING="$CMDLINE_STRING \"$i\""
done
eval $UEMCLI_INSTALL_PATH/bin/uemcli "$CMDLINE_STRING"
exit $?

Re: Nagios return 0byte string from bash script

Posted: Tue Jun 19, 2018 1:09 pm
by scottwilkerson
What debugging output have you added to the script to see where the problem might be?

I'd like to help you but we don't have these systems and I have no idea what this should output.

You are going to need to debug this script (plugin) and the additional items to see where the error is.