Page 1 of 1

ncpa command line not working

Posted: Fri Oct 25, 2019 4:06 pm
by sampaths
Hi,

We are running
NagiosXI 5.5.9 as a vmware image

We use nrpe for all our linux monitoring. Wanted to tryout ncpa.
https://assets.nagios.com/downloads/ncp ... g-NCPA.pdf
followed this document and installed NCPA on a SUSE 12 linux box
<hostname>:~ # rpm -qa | grep ncpa
ncpa-2.1.7-1.x86_64
<hostname>:~ #

Was able to use the NCPA wizard and configure the server for monitoring the basic default cpu, memory and all that and it works fine.
1.PNG
2.PNG
3.PNG
but if i run the command from the NagiosXI server on command line it does not work.
root@nagiosxi:/usr/local/nagios/libexec# ./check_ncpa.py -H <hostname> -t '<token>' -P 5693 -M cpu/percent -w 20 -c 40 -q 'aggregate=avg'
UNKNOWN: Execution exceeded timeout threshold of 60s
root@nagiosxi:/usr/local/nagios/libexec#
root@nagiosxi:/usr/local/nagios/libexec# nmap <hostname> -p 5693
Starting Nmap 6.47 ( http://nmap.org ) at 2019-10-25 15:47 CDT
Nmap scan report for <hostname> (XX.XX.XX.XX)
Host is up (0.00034s latency).
PORT STATE SERVICE
5693/tcp open unknown
MAC Address: XX:XX:XX:XX:XX:XX (VMware)

Nmap done: 1 IP address (1 host up) scanned in 0.04 seconds
root@nagiosxi:/usr/local/nagios/libexec# /usr/local/nagios/libexec/check_ncpa.py -V
check_ncpa.py, Version 1.1.3
root@nagiosxi:/usr/local/nagios/libexec# /usr/local/nagios/libexec/check_ncpa.py -H <hostname> -t '<token>' -P 5693 -M system/agent_version
UNKNOWN: Execution exceeded timeout threshold of 60s
root@nagiosxi:/usr/local/nagios/libexec#
root@nagiosxi:/usr/local/nagios/libexec# su -c "whoami" - nagios
nagios
root@nagiosxi:/usr/local/nagios/libexec# su -c "/usr/local/nagios/libexec/check_ncpa.py -H <hostname> -t '<token>' -P 5693 -M system/agent_version" - nagios
UNKNOWN: Execution exceeded timeout threshold of 60s
root@nagiosxi:/usr/local/nagios/libexec#

Re: ncpa command line not working

Posted: Mon Oct 28, 2019 9:46 am
by benjaminsmith
Hello @sampaths,

Typically, if there's a timeout issue it is network related, especially since the commands are working from the Nagios web interface.

Try testing from the command line again but increase timeout value to more than 60 seconds, and add the verbose option to print additional error messages. Post any error messages to the thread.

Code: Select all

./check_ncpa.py -H 192.168.5.23 -t 'welcome' -P 5693 -M system/agent_version -T 120 -v

Re: ncpa command line not working

Posted: Mon Oct 28, 2019 11:00 am
by sampaths
Getting timeout even after increasing the time

root@nagiosxi:/usr/local/nagios/libexec# ./check_ncpa.py -H <hostname> -t <token> -P 5693 -M system/agent_version -T 120 -v
Connecting to: https://<hostname>:5693/api/system/agent_version/?token=<token>&check=1
An error occurred:<urlopen error [Errno 110] Connection timed out>
root@nagiosxi:/usr/local/nagios/libexec#

Re: ncpa command line not working

Posted: Mon Oct 28, 2019 12:03 pm
by lmiltchev
root@nagiosxi:/usr/local/nagios/libexec# ./check_ncpa.py -H <hostname> -t <token> -P 5693 -M system/agent_version -T 120 -v
Are you sure that you are using the same hostname in the command line as the one used in the GUI? Have you tried using an ip address instead of a hostname (FQDM)? Do you see any errors in the "ncpa_listener.log"?

Re: ncpa command line not working

Posted: Mon Oct 28, 2019 1:08 pm
by sampaths
Hi lmiltchev, sent a PM to you with the actual hostnames and stuff.

Re: ncpa command line not working

Posted: Mon Oct 28, 2019 2:21 pm
by lmiltchev
Replied via PM.

Re: ncpa command line not working

Posted: Mon Oct 28, 2019 3:38 pm
by sampaths
Thank you @lmiltchev for helping us fix the issue. :)

There was a proxy setup in the env, unsetting them fixed the issue.

unset {http,https,ftp}_proxy
unset {HTTP,HTTPS,FTP}_PROXY

Now it works in command line.
root@nagiosxi:/usr/local/nagios/libexec# ./check_ncpa.py -H <hostname> -t <token> -P 5693 -M system/agent_version -T 120 -v
Connecting to: https://<hostname>:5693/api/system/agent_version/?token=<token>&check=1
File returned contained:
{
"perfdata": "",
"returncode": 0,
"stdout": "OK: Agent_version was ['2.1.7']"
}
OK: Agent_version was ['2.1.7']
root@nagiosxi:/usr/local/nagios/libexec#

Re: ncpa command line not working

Posted: Mon Oct 28, 2019 4:38 pm
by benjaminsmith
Hello @sampths,

Great. Thanks for the update and solution.

We'll go ahead and close this out but feel free to open another if you have any new questions.