Return code of 126 is out of bounds error for plugin

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
localgod
Posts: 3
Joined: Wed Dec 17, 2014 10:53 am

Return code of 126 is out of bounds error for plugin

Post by localgod »

I have created a plugin called "check_oracle_login" and symlinked it to the folder with the build in plugins with the same owner and the same permissions:

Code: Select all

#!/usr/bin/env php
<?php
$db = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = host)(PORT = 1521)))(CONNECT_DATA=(SERVICE_NAME=name)))";

$conn = OCILogon ( 'user', 'pass', $db );
if (! $conn) {
	exit(2);
}
exit(0);
I have the created this command:

Code: Select all

define command{
        command_name    check_oracle_login
        command_line    $USER1$/check_oracle_login
}
And this service:

Code: Select all

define service {
        use                     generic-service
        host_name               localhost
        service_description     Check valid login
        check_command           check_oracle_login
        contacts                nagiosadmin
        contact_groups          admins
}
When I check the config files with

Code: Select all

 nagios -v /etc/nagios/nagios.cfg
everything seems ok
but when the check is performed I get this error in the front end: (Return code of 126 is out of bounds - plugin may not be executable)

Im running Centos 6.6, and Nagios Core 3.5.1

Any pointers or help appreciated.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Return code of 126 is out of bounds error for plugin

Post by scottwilkerson »

you need to make you plugin executable

Code: Select all

chmod +x check_oracle_login
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
localgod
Posts: 3
Joined: Wed Dec 17, 2014 10:53 am

Re: Return code of 126 is out of bounds error for plugin

Post by localgod »

I have tried everything from 755 to 777.... no luck.
emislivec
Posts: 52
Joined: Tue Feb 25, 2014 10:06 am

Re: Return code of 126 is out of bounds error for plugin

Post by emislivec »

The target of the check_oracle_login symlink needs to be executable by the nagios user too. Assuming $USER1$ is /usr/local/nagios/libexec:

Code: Select all

ls -l /usr/local/nagios/libexec/check_oracle_login
ls -lL /usr/local/nagios/libexec/check_oracle_login
Should give output like this (for check_udp on a test system):

Code: Select all

[root@coinage-core libexec]# ls -l check_udp 
lrwxrwxrwx. 1 root root 9 May 19  2014 check_udp -> check_tcp
[root@coinage-core libexec]# ls -lL check_udp 
-rwxr-xr-x. 1 nagios nagios 221955 May 19  2014 check_udp
We can test that the nagios user can execute the plugin without having to setup a check:

Code: Select all

sudo -u nagios /usr/local/nagios/libexec/check_oracle_login
localgod
Posts: 3
Joined: Wed Dec 17, 2014 10:53 am

Re: Return code of 126 is out of bounds error for plugin

Post by localgod »

Thanks... that solved the problem.
Locked