Problems with check_ncpa.py on fresh install 5.7.1

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
lilydalehs
Posts: 34
Joined: Fri May 29, 2020 7:20 pm

Problems with check_ncpa.py on fresh install 5.7.1

Post by lilydalehs »

Hi All,

I thought I might try a fresh install of 5.7.1 on a Ubuntu 20.04 server. The server was freshly installed, and I ran the manual installation as per https://assets.nagios.com/downloads/nag ... -Linux.pdf (The only departure from the instructions was that I used sudo ./fullinstall as I was logged in as a non-root user.)

Everything seemed to go ok, but when i tried adding my first server to monitor via ncpa there were issues.

When I run the command /usr/local/nagios/libexec/check_ncpa.py I get the error message
/usr/bin/env: ‘python’: No such file or directory

Regards,
Chris.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Problems with check_ncpa.py on fresh install 5.7.1

Post by lmiltchev »

Have you customized this system, e.g. installing a different version of python from the "default"? It looks like the system doesn't know where the python executable is.

What is the output of the following commands?

Code: Select all

which python
whereis python
python --version
Be sure to check out our Knowledgebase for helpful articles and solutions!
lilydalehs
Posts: 34
Joined: Fri May 29, 2020 7:20 pm

Re: Problems with check_ncpa.py on fresh install 5.7.1

Post by lilydalehs »

Hi lmiltchev,

thanks for the response. This was a brand new install of Ubuntu 20.04 spunup minutes before installing nagios. The only "extra" was the installation of openssh server.

which python => returns nothing

whereis python returns

Code: Select all

python: /usr/bin/python3.8 /usr/bin/python3.8-config /usr/bin/python2.7 /usr/lib/python /usr/lib/python3.8 /usr/lib/python2.7 /etc/python3.8 /etc/python2.7 /usr/local/lib/python3.8 /usr/local/lib/python2.7 /usr/include/python3.8 /usr/include/python2.7 /usr/share/python
python --version returns

Code: Select all

Command 'python' not found, did you mean:

  command 'python3' from deb python3
  command 'python' from deb python-is-python3
Cheers,
Chris.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Problems with check_ncpa.py on fresh install 5.7.1

Post by lmiltchev »

OK, run the following command:

Code: Select all

sudo ln -s /usr/bin/python3.8 /usr/bin/python
then try again:

Code: Select all

which python
python --version
Did you get an output now? If the two commands listed above worked, try the check_ncpa.py plugin again.
Be sure to check out our Knowledgebase for helpful articles and solutions!
lilydalehs
Posts: 34
Joined: Fri May 29, 2020 7:20 pm

Re: Problems with check_ncpa.py on fresh install 5.7.1

Post by lilydalehs »

Hi lmiltchev,

thanks for the response. That command seems to have worked.

which python returns

Code: Select all

/usr/bin/python
python --version returns

Code: Select all

Python 3.8.2
Now, when I run the following command from the commandline on the server
/usr/local/nagios/libexec/check_ncpa.py -H 10.174.64.179 -t 'mytoken' -P 5693 -M cpu/percent -w '20' -c '40' -q 'aggregate=avg'

I get

Code: Select all

b"UNKNOWN: An error occured connecting to API. (Connection error: 'Tunnel connection failed: 403 Forbidden')"
And i also get it if I use the "try test command" from within the service configuration page.

However, the service checks seem to be working within nagios.

I notice that all the commands return a b" at the start of them. Is this normal?

Cheers,
Chris.
You do not have the required permissions to view the files attached to this post.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Problems with check_ncpa.py on fresh install 5.7.1

Post by lmiltchev »

Download the latest NCPA wizard from here:

http://assets.nagios.com/downloads/nagi ... 7/ncpa.zip

Don't unzip the file, just install it as you would any other wizard:

Admin > System Extensions > Manage Config Wizards > Browse > ncpa.zip > Upload & Install

Let us know if this fixed your issue.
Be sure to check out our Knowledgebase for helpful articles and solutions!
lilydalehs
Posts: 34
Joined: Fri May 29, 2020 7:20 pm

Re: Problems with check_ncpa.py on fresh install 5.7.1

Post by lilydalehs »

Hi lmiltchev,

thanks for the response. Updating the wizard as instructed removed those stray characters from the return and the service checks are working well now.

However, I still can't run the command as a test or from the command line as shown here.

Cheers,
Chris.
You do not have the required permissions to view the files attached to this post.
lilydalehs
Posts: 34
Joined: Fri May 29, 2020 7:20 pm

Re: Problems with check_ncpa.py on fresh install 5.7.1

Post by lilydalehs »

Ok, I've figured out that the error is due to the system proxy settings. Somehow I need to add a proxy exclusion for local networks so that this can work.

Cheers,
Chris.
lilydalehs
Posts: 34
Joined: Fri May 29, 2020 7:20 pm

Re: Problems with check_ncpa.py on fresh install 5.7.1

Post by lilydalehs »

Hi lmiltchev,

I have this working. Unbelievably, you can't set a network ip range in the no_proxy setting in Ubuntu, but if I use hostnames rather than IP addresses I can get the proxy exclusions working.

Thanks for all your assistance.

Cheers,
Chris.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Problems with check_ncpa.py on fresh install 5.7.1

Post by scottwilkerson »

lilydalehs wrote:Hi lmiltchev,

I have this working. Unbelievably, you can't set a network ip range in the no_proxy setting in Ubuntu, but if I use hostnames rather than IP addresses I can get the proxy exclusions working.

Thanks for all your assistance.

Cheers,
Chris.
Glad to hear you have it working!

Locking thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked