Page 1 of 1

Return code of 126 is out of bounds error for plugin

Posted: Thu Dec 18, 2014 4:20 am
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.

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

Posted: Thu Dec 18, 2014 10:16 am
by scottwilkerson
you need to make you plugin executable

Code: Select all

chmod +x check_oracle_login

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

Posted: Thu Dec 18, 2014 12:18 pm
by localgod
I have tried everything from 755 to 777.... no luck.

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

Posted: Thu Dec 18, 2014 12:46 pm
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

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

Posted: Fri Dec 19, 2014 4:14 am
by localgod
Thanks... that solved the problem.