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

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
mrochelle
Posts: 238
Joined: Fri May 04, 2012 11:20 am
Location: Heart of America

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

Post 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,
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

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

Post by mguthrie »

Can you try running it as the Nagios user?

Code: Select all

su nagios -c '/usr/local/nagios/libexec/check_ping'
User avatar
mrochelle
Posts: 238
Joined: Fri May 04, 2012 11:20 am
Location: Heart of America

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

Post by mrochelle »

Command line as nagios user works fine. I only have the problem from the check in the web interface.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

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

Post by scottwilkerson »

Can you send the output of the following command

Code: Select all

ls -l /usr/local/nagios/libexec/check_ping
thanks
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
User avatar
mrochelle
Posts: 238
Joined: Fri May 04, 2012 11:20 am
Location: Heart of America

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

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

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

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
User avatar
mrochelle
Posts: 238
Joined: Fri May 04, 2012 11:20 am
Location: Heart of America

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

Post 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$
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

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

Post 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
User avatar
mrochelle
Posts: 238
Joined: Fri May 04, 2012 11:20 am
Location: Heart of America

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

Post 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?
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

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

Post 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
Locked