NCPA.py Issue on Ubuntu Server 18.04

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

NCPA.py Issue on Ubuntu Server 18.04

Postby rgoddard » Thu May 30, 2019 3:15 pm

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?
rgoddard
 
Posts: 1
Joined: Thu May 30, 2019 2:55 pm

Re: NCPA.py Issue on Ubuntu Server 18.04

Postby npolovenko » Thu May 30, 2019 4:05 pm

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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
npolovenko
Support Tech
 
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: NCPA.py Issue on Ubuntu Server 18.04

Postby mcapra » Fri May 31, 2019 8:44 am

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
Former Nagios employee
http://www.mcapra.com/
User avatar
mcapra
 
Posts: 3561
Joined: Thu May 05, 2016 3:54 pm

Re: NCPA.py Issue on Ubuntu Server 18.04

Postby scottwilkerson » Fri May 31, 2019 2:04 pm

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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 15057
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises


Return to Nagios Core

Who is online

Users browsing this forum: No registered users and 5 guests