Page 1 of 2

[STDERR][EC 126]/bin/sh: Cannot execute binary file

Posted: Fri Sep 28, 2012 10:18 am
by mrochelle
nagiosdeva 2.6.32-279.5.1.el6.x86_64 x86_64
CentOS release 6.3 (Final)

I believe this must be something obvious that I have missed. I have refreshed my dev. environment and the default local host checks indicate the following:
[STDERR][EC 126]/bin/sh: /usr/local/nagios/libexec/check_ping: cannot execute binary file

However, I can execute the check without a problem manually from the command line?
Thanks in advance,

Re: [STDERR][EC 126]/bin/sh: Cannot execute binary file

Posted: Fri Sep 28, 2012 11:33 am
by mguthrie
Can you try running it as the Nagios user?

Code: Select all

su nagios -c '/usr/local/nagios/libexec/check_ping'

Re: [STDERR][EC 126]/bin/sh: Cannot execute binary file

Posted: Fri Sep 28, 2012 12:14 pm
by mrochelle
Command line as nagios user works fine. I only have the problem from the check in the web interface.

Re: [STDERR][EC 126]/bin/sh: Cannot execute binary file

Posted: Sat Sep 29, 2012 5:05 pm
by scottwilkerson
Can you send the output of the following command

Code: Select all

ls -l /usr/local/nagios/libexec/check_ping
thanks

Re: [STDERR][EC 126]/bin/sh: Cannot execute binary file

Posted: Sat Sep 29, 2012 5:35 pm
by mrochelle
[root@nagiosdeva ~]# ls -l /usr/local/nagios/libexec/check_ping
-rwxr-xr-x. 1 root root 99658 Jun 6 16:15 /usr/local/nagios/libexec/check_ping

Re: [STDERR][EC 126]/bin/sh: Cannot execute binary file

Posted: Sat Sep 29, 2012 6:54 pm
by scottwilkerson
Can you send the command from your /usr/local/nagios/etc/commands.cfg that you are trying to run from nagios that is producing this error

Re: [STDERR][EC 126]/bin/sh: Cannot execute binary file

Posted: Tue Oct 02, 2012 10:04 am
by mrochelle
check_xi_host_ping
$USER1$/check_icmp -H $HOSTADDRESS$ -w $ARG1$,$ARG2$ -c $ARG3$,$ARG4$ -p 5

check_xi_host_http
$USER1$/check_http -H $HOSTADDRESS$ $ARG1$

check_icmp
$USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$

Re: [STDERR][EC 126]/bin/sh: Cannot execute binary file

Posted: Tue Oct 02, 2012 10:16 am
by mguthrie
Just to rule out any permissions issues, lets try adding the following permissions to the file and see the issue resolves itself:

Code: Select all

chmod +x /usr/local/nagios/libexec/check_ping

Re: [STDERR][EC 126]/bin/sh: Cannot execute binary file

Posted: Tue Oct 02, 2012 10:34 am
by mrochelle
No change...For the record, I believe I mentioned previously, that all commands work from the command line. The problem seems to be from the web interface?

Re: [STDERR][EC 126]/bin/sh: Cannot execute binary file

Posted: Tue Oct 02, 2012 11:01 am
by mguthrie
Agreed, but the Nagios Core daemon is what executes the check from the command-line as the nagios user, and the output is simply displayed in the browser.

What do you get from running:

Code: Select all

whereis ping