Return code of 127 is out of bounds

Hi
I am trying to monitor a service on a windows machine using the check_snmp_win.pl script ( found it on nagios exchange )
the script run with no prbolems from command line - for example :
./check_win_snmp.pl -H 192.168.1.50 -C public -n mssql -N 2
but , when when i used it from nagios i recieve "Return code of 127 is out of bounds "

configuration files


serivice.cfg

Service definition - check sql service

define service{
use generic-service
host_name sqlapp
service_description Sql_Service
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 3
retry_check_interval 1
contact_groups servers-admins
notification_interval 120
notification_period 24x7
notification_options w,c
check_command check_service!public!mssql!1
}

and checkcommands.cfg

Check Windows Services

define command{
command_name check_service
command_line ‘$USER1$/check_snmp_win.pl -H $HOSTADDRESS$ -C $ARG1$ -n $ARG2$ -N $ARG3$’
}

I am running nagios on debian sarge

Any idea ?

Eyal

run as user nagios and see if it’s a permission problem. most probably it is. try a search on the forum too. could help :slight_smile:

Luca

I concur.
Your .pl script should be located in /usr/local/nagios/libexec and have permissions of nagios.nagios.
OR
the nagios user can’t execute that script.

  1. su - nagios
  2. cd /usr/local/nagios/libexec/
  3. ./check_snmp_win.pl -H xx.xx.xx.xx -C public -n mssql -N 1
  4. Does the command work as user nagios now? If so, then we can continue to t’shoot.

Verify that the $USER1$ macro (resource.cfg) enable and points to the location the plugins were installed to and/or your command definitions use that macro or specify the full path to the plugin.

ok .

  1. i created the /usr/local/nagios/libexec directory ( did not exist ) .
  2. i copied the plugin + utils.pm files to this directory .
  3. change owner and group to nagios
  4. change the command_line in checkcommand.cfg to point this directory.

it works !!!
Thanks