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?
Python issues with Mod Gearman
Re: Python issues with Mod Gearman
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
[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
Re: Python issues with Mod Gearman
What OS/version are you running?
You may need to create a symlink for it:
https://stackoverflow.com/a/61608129
Code: Select all
uname -a
cat /etc/*releasehttps://stackoverflow.com/a/61608129
Re: Python issues with Mod Gearman
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.
[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.
Re: Python issues with Mod Gearman
Symlink worked as far as I can tell. I'll assume no issues using the newer python until I run into something.
Re: Python issues with Mod Gearman
The default on my EL7 system is a symlink that points to 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.
Code: Select all
[root@xid ~]# ll /usr/bin/python
lrwxrwxrwx 1 root root 7 Sep 18 09:29 /usr/bin/python -> python2