Page 1 of 1

NCPA.py Issue on Ubuntu Server 18.04

Posted: Thu May 30, 2019 3:15 pm
by rgoddard
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?

Re: NCPA.py Issue on Ubuntu Server 18.04

Posted: Thu May 30, 2019 4:05 pm
by npolovenko
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:

Code: Select all

#!/usr/bin/env python
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:

Code: Select all

which python

Code: Select all

/usr/bin/env

Re: NCPA.py Issue on Ubuntu Server 18.04

Posted: Fri May 31, 2019 8:44 am
by mcapra
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

Re: NCPA.py Issue on Ubuntu Server 18.04

Posted: Fri May 31, 2019 2:04 pm
by scottwilkerson
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
You would then run the following to convert the script to the correct line endings:

Code: Select all

dos2unix /usr/local/nagios/libexec/check_ncpa.py