Execvpe(/usr/lib64/nagios/plugins/check_test.py) failed: Permission denied

I wrote a python test plugin /usr/lib64/nagios/plugins/check_test.py . The file content is below:

#!/etc/python
print "Hello, World!"
exit(0)

ls -la /usr/lib64/nagios/plugins/check_test.py output below
-rwxrwxrwx. 1 root root 44 Sep 20 11:03 /usr/lib64/nagios/plugins/check_test.py

Added below to /etc/icinga2/conf.d/command.conf

object CheckCommand "test" {
   command = [ PluginDir + "/check_test.py" ]
}

Added below to /etc/icinga2/conf.d/services.conf

apply Service "test" {
  import "generic-service"

  check_command = "test"

  assign where host.address
}

On icingaweb2. I see the service is available. But its showing UNKNOWN status with

Plugin Output

execvpe(/usr/lib64/nagios/plugins/check_test.py) failed: Permission denied

Your shebang line is very likely wrong as /etc/python is not the location of the python binary, but this should result in a bad interpreter message.

Is your system running with SELinux enforcement (sestatus) and how is the context of the script (ls -lZ /usr/lib64/nagios/plugins/check_test.py) as this is what in addition to the file permissions will limit executability?

2 Likes

It worked!! the python library was pointing toa wrong location. Thanks