NOOB: (Return code of 127 is out of bounds - plugin may be

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.
McHenry
Posts: 16
Joined: Thu Jan 15, 2015 5:01 pm

NOOB: (Return code of 127 is out of bounds - plugin may be

Post by McHenry »

I am a new user and have some basic monitoring working. I am interested in getting the following printer plugin working:
https://exchange.nagios.org/directory/P ... ck/details

The response I received for both services is:
"(Return code of 127 is out of bounds - plugin may be missing)"


I have checked the $USER1$ variable to confirm the plugin path:

root@apollo:~# grep "USER1" /etc/nagios3/resource.cfg
# Nagios supports up to 32 $USERx$ macros ($USER1$ through $USER32$)
# Sets $USER1$ to be the path to the plugins
$USER1$=/usr/lib/nagios/plugins


The plugin is located in the correct location:

root@apollo:~# ls -l /usr/lib/nagios/plugins/check_snmp_printer.sh
-rwxr-xr-x 1 root root 32658 Mar 28 12:50 /usr/lib/nagios/plugins/check_snmp_printer.sh


in /etc/nagios3/command.cfg I have the following:

define command{
command_name check_snmp_printer
command_line $USER1$/check_snmp_printer -H $HOSTADDRESS -C $ARG1$ -x $ARG2 -w $ARG3$ -c $ARG4$
}


In /etc/nagios3/objects/printers.cfg I have the following two services defined:

define service{
use generic-service
hostgroups hp-printers ; The name of the host the service is associated with
service_description Toner Supply
check_command check_snmp_printer!public!"CONSUM Toners"!20!10
}

define service{
use generic-service
hostgroups hp-printers ; The name of the host the service is associated with
service_description Paper Supply
check_command check_snmp_printer!public!"TRAY ALL"!25%!0%
}


Any help would be greatly appreciated. Thanks in advance...
User avatar
rhassing
Posts: 412
Joined: Sat Oct 05, 2013 10:29 pm
Location: Netherlands

Re: NOOB: (Return code of 127 is out of bounds - plugin may

Post by rhassing »

Do you have selinux enabled?

Code: Select all

getenforce
You should disable it

Code: Select all

setenforce 0
Rob Hassing
Image
McHenry
Posts: 16
Joined: Thu Jan 15, 2015 5:01 pm

Re: NOOB: (Return code of 127 is out of bounds - plugin may

Post by McHenry »

Thanks Rob. SELinux was already disabled.

root@apollo:~# getenforce
Disabled
root@apollo:~#
User avatar
rhassing
Posts: 412
Joined: Sat Oct 05, 2013 10:29 pm
Location: Netherlands

Re: NOOB: (Return code of 127 is out of bounds - plugin may

Post by rhassing »

What happens if you run the command from the command line?
Rob Hassing
Image
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: NOOB: (Return code of 127 is out of bounds - plugin may

Post by rkennedy »

Code: Select all

root@apollo:~# ls -l /usr/lib/nagios/plugins/check_snmp_printer.sh
-rwxr-xr-x 1 root root 32658 Mar 28 12:50 /usr/lib/nagios/plugins/check_snmp_printer.sh
You'll want to adjust the permissions accordingly, as having this file owned by root can lead to issues. Take a look at what everything else is set to in that folder.

If you run the check over the CLI, does it work fine?
Former Nagios Employee
McHenry
Posts: 16
Joined: Thu Jan 15, 2015 5:01 pm

Re: NOOB: (Return code of 127 is out of bounds - plugin may

Post by McHenry »

Hi Rob and thanks once again. The file permissions are the same as the others in the folder:

root@apollo:/usr/lib/nagios/plugins# ls -l check_s*
-rwxr-xr-x 1 root root 1453 Mar 13 2014 check_sensors
lrwxrwxrwx 1 root root 9 Mar 13 2014 check_simap -> check_tcp
-rwxr-xr-x 1 root root 64216 Mar 13 2014 check_smtp
-rwxr-xr-x 1 root root 72936 Mar 13 2014 check_snmp
-rwxr-xr-x 1 root root 32658 Mar 28 12:50 check_snmp_printer.sh
lrwxrwxrwx 1 root root 9 Mar 13 2014 check_spop -> check_tcp
-rwxr-xr-x 1 root root 43384 Mar 13 2014 check_ssh
lrwxrwxrwx 1 root root 9 Mar 13 2014 check_ssmtp -> check_tcp
-rwxr-xr-x 1 root root 43240 Mar 13 2014 check_swap


From the CLI it appears to run fine.

root@apollo:/usr/lib/nagios/plugins# ./check_snmp_printer.sh -V
check_snmp_printer.sh - version 3.14159
root@apollo:/usr/lib/nagios/plugins# ./check_snmp_printer.sh -H 192.1.1.152 -C public -x MODEL
"Canon LBP6300 1.01", Serial #
McHenry
Posts: 16
Joined: Thu Jan 15, 2015 5:01 pm

Re: NOOB: (Return code of 127 is out of bounds - plugin may

Post by McHenry »

I did find an error in the command definition whereby it was missing two "$" I have now updated it from:

define command{
command_name check_snmp_printer
command_line $USER1$/check_snmp_printer -H $HOSTADDRESS -C $ARG1$ -x $ARG2 -w $ARG3$ -c $ARG4$
}

to

define command{
command_name check_printers
command_line $USER1$/check_snmp_printer -H $HOSTADDRESS$ -C $ARG1$ -x $ARG2$ -w $ARG3$ -c $ARG4$
}

I have also updated my service checks to use the new command name "check_printers":

define service{
use generic-service
hostgroups hp-printers ; The name of the host the service is associated with
service_description Paper Supply
check_command check_printers!public!"TRAY ALL"!25%!0%
}
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: NOOB: (Return code of 127 is out of bounds - plugin may

Post by hsmith »

Is this working correctly after you made those changes?
Former Nagios Employee.
me.
McHenry
Posts: 16
Joined: Thu Jan 15, 2015 5:01 pm

Re: NOOB: (Return code of 127 is out of bounds - plugin may

Post by McHenry »

Unfortunately not.

I have restarted the server however the error remains.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: NOOB: (Return code of 127 is out of bounds - plugin may

Post by rkennedy »

The permissions should not be root:root, they should be set to the user / group you're going to execute them as. For reference, did you follow some sort of guide when installing your plugins?
Former Nagios Employee
Locked