When trying to test ncpa.py passive checks against a windows server using ./check_ncpa.py -H hostname -t 'token' -M 'disk/logical/C:|' --units G im getting this error:
/usr/bin/env: ‘python\r’: No such file or directory
I have tried googling the issue but havent really found anything. Can anyone help with this?
NCPA.py Issue on Ubuntu Server 18.04
-
- Support Tech
- Posts: 3457
- Joined: Mon May 15, 2017 5:00 pm
Re: NCPA.py Issue on Ubuntu Server 18.04
Hello, @rgoddard. This looks like an active check to me.
But the reason why you're seeing the error is because the check_ncpa script starts with:
It's looking for the python environment variable and it can't find it.
Please run these commands on the server where this command fails and show me the output:
But the reason why you're seeing the error is because the check_ncpa script starts with:
Code: Select all
#!/usr/bin/env python
Please run these commands on the server where this command fails and show me the output:
Code: Select all
which python
Code: Select all
/usr/bin/env
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: NCPA.py Issue on Ubuntu Server 18.04
The \r implies there may have been some copying+pasting or general file transfer between a Unix and Windows machine that junked-up the line endings. More info:
http://www.cs.toronto.edu/~krueger/csc2 ... dings.html
I'd double-check your file to make sure it's not being run on a Unix system with Windows line-endings. dos2unix is a handy utility to convert those line endings to Unix-friendly ones and may be a good first step.
http://www.cs.toronto.edu/~krueger/csc2 ... dings.html
I'd double-check your file to make sure it's not being run on a Unix system with Windows line-endings. dos2unix is a handy utility to convert those line endings to Unix-friendly ones and may be a good first step.
Code: Select all
yum install dos2unix
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: NCPA.py Issue on Ubuntu Server 18.04
You would then run the following to convert the script to the correct line endings:mcapra wrote:The \r implies there may have been some copying+pasting or general file transfer between a Unix and Windows machine that junked-up the line endings. More info:
http://www.cs.toronto.edu/~krueger/csc2 ... dings.html
I'd double-check your file to make sure it's not being run on a Unix system with Windows line-endings. dos2unix is a handy utility to convert those line endings to Unix-friendly ones and may be a good first step.
Code: Select all
yum install dos2unix
Code: Select all
dos2unix /usr/local/nagios/libexec/check_ncpa.py