Nagios return 0byte string from bash script

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
raja2206
Posts: 7
Joined: Mon Jun 11, 2018 5:07 am

Re: Nagios return 0byte string from bash script

Post 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 ?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios return 0byte string from bash script

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
raja2206
Posts: 7
Joined: Mon Jun 11, 2018 5:07 am

Re: Nagios return 0byte string from bash script

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios return 0byte string from bash script

Post 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?
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
raja2206
Posts: 7
Joined: Mon Jun 11, 2018 5:07 am

Re: Nagios return 0byte string from bash script

Post 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 $?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios return 0byte string from bash script

Post 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.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked