NCPA.py Issue on Ubuntu Server 18.04

Engage with the community of users including those using the open source solutions.
Includes Nagios Core, Plugins, and NCPA

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: 3601
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: 19020
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises


Return to Community Support

Who is online

Users browsing this forum: Auel, Google [Bot], JONA-PMS and 42 guests