Nagios return 0byte string from bash script

This board serves as an open discussion and support collaboration point for Nagios XI. NOTE: Nagios XI customers should use the Customer Support forum to obtain expedited support.

Re: Nagios return 0byte string from bash script

Postby raja2206 » Wed Jun 13, 2018 9:29 pm

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 ?
raja2206
 
Posts: 7
Joined: Mon Jun 11, 2018 5:07 am

Re: Nagios return 0byte string from bash script

Postby scottwilkerson » Thu Jun 14, 2018 8:45 am

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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
CTO
 
Posts: 9691
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Nagios return 0byte string from bash script

Postby raja2206 » Mon Jun 18, 2018 4:23 am

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
raja2206
 
Posts: 7
Joined: Mon Jun 11, 2018 5:07 am

Re: Nagios return 0byte string from bash script

Postby scottwilkerson » Mon Jun 18, 2018 12:52 pm

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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
CTO
 
Posts: 9691
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Nagios return 0byte string from bash script

Postby raja2206 » Tue Jun 19, 2018 4:33 am

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 $?
raja2206
 
Posts: 7
Joined: Mon Jun 11, 2018 5:07 am

Re: Nagios return 0byte string from bash script

Postby scottwilkerson » Tue Jun 19, 2018 1:09 pm

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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
CTO
 
Posts: 9691
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Previous

Return to Nagios XI

Who is online

Users browsing this forum: No registered users and 13 guests