Python issues with Mod Gearman

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
J.A.K
Posts: 103
Joined: Wed Aug 05, 2020 11:39 am

Python issues with Mod Gearman

Post by J.A.K »

When running a check_ncpa check on a Mod Gearman worker I get:

CRITICAL: Return code of 127 is out of bounds. Make sure the plugin you're trying to run actually exists. (worker: vml1039)
[/usr/bin/env: ‘python’: No such file or directory]

From looking around it seems to be because I have python3 installed instead of python2. I went ahead and installed python 2.7, but still getting the same error. Was there a prereq in the Nagios Plugins I missed setting this up?
J.A.K
Posts: 103
Joined: Wed Aug 05, 2020 11:39 am

Re: Python issues with Mod Gearman

Post by J.A.K »

And just for additional information I did run dos2unix on the check_ncpa.py file just in case. Python3 works fine.

[f10000003j@vml1039 libexec]$ ./check_ncpa.py
/usr/bin/env: ‘python’: No such file or directory
[f10000003j@vml1039 libexec]$ python3 ./check_ncpa.py
Usage: check_ncpa.py [options]

Options:
-h, --help show this help message and exit
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Python issues with Mod Gearman

Post by ssax »

What OS/version are you running?

Code: Select all

uname -a
cat /etc/*release
You may need to create a symlink for it:

https://stackoverflow.com/a/61608129
J.A.K
Posts: 103
Joined: Wed Aug 05, 2020 11:39 am

Re: Python issues with Mod Gearman

Post by J.A.K »

RHEL 8.2

[f10000003j@vml1039 ~]$ uname -a
Linux vml1039 4.18.0-193.19.1.el8_2.x86_64 #1 SMP Wed Aug 26 15:29:02 EDT 2020 x86_64 x86_64 x86_64 GNU/Linux
[f10000003j@vml1039 ~]$ cat /etc/*release
NAME="Red Hat Enterprise Linux"
VERSION="8.2 (Ootpa)"

So it shipped with Python 3.6 out the gate. I considered the symlink, but hadn't seen documentation anywhere for Mod_Gearman saying to do that and NCPA seemed like one of the more common things a user would run. Wanted to make sure I hadn't missed an obvious step.
J.A.K
Posts: 103
Joined: Wed Aug 05, 2020 11:39 am

Re: Python issues with Mod Gearman

Post by J.A.K »

Symlink worked as far as I can tell. I'll assume no issues using the newer python until I run into something.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Python issues with Mod Gearman

Post by ssax »

The default on my EL7 system is a symlink that points to python2:

Code: Select all

[root@xid ~]# ll /usr/bin/python
lrwxrwxrwx 1 root root 7 Sep 18 09:29 /usr/bin/python -> python2
So a symlink is likely all that's required to resolve it. Thanks for posting your update, let us know if you see any issues.
Locked