Random Project

Works, but getting 126 in nagios

This works great when running it from CentOS terminal with root, but when I created the command in /etc/nagios/objects/commands.cfg and called it in services.cfg nagios gives me the following status(Return code of 126 is out of bounds – plugin may not be executable.

define command{
command_name check_esxi_hardware
command_line $USER1$/check_esxi_hardware.py -H $HOSTADDRESS$ -U $ARG1$ -P $ARG2$ -V $ARG3$
}

define service{
use generic-service
hostgroup_name VMWare-servers
service_description System: ESXi Hardware status
check_command check_esxi_hardware!root!mypass!hp
}

I have verified that the check_esxi_hardware.py is executable, considering I am able to run it from the command line. I used chmod -R 755 root.root /usr/lib64/nagios/plugins/check_esxi_hardware.py. So why am I getting a return code 126 from Nagios when the command is executable?