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 ?
Nagios return 0byte string from bash script
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Nagios return 0byte string from bash script
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
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
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
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
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Nagios return 0byte string from bash script
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
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 $?
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 $?
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Nagios return 0byte string from bash script
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.
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.