ncpa command line not working

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
sampaths
Posts: 13
Joined: Tue Sep 04, 2018 10:32 am

ncpa command line not working

Post 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#
You do not have the required permissions to view the files attached to this post.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: ncpa command line not working

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
sampaths
Posts: 13
Joined: Tue Sep 04, 2018 10:32 am

Re: ncpa command line not working

Post 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#
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: ncpa command line not working

Post 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"?
Be sure to check out our Knowledgebase for helpful articles and solutions!
sampaths
Posts: 13
Joined: Tue Sep 04, 2018 10:32 am

Re: ncpa command line not working

Post by sampaths »

Hi lmiltchev, sent a PM to you with the actual hostnames and stuff.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: ncpa command line not working

Post by lmiltchev »

Replied via PM.
Be sure to check out our Knowledgebase for helpful articles and solutions!
sampaths
Posts: 13
Joined: Tue Sep 04, 2018 10:32 am

Re: ncpa command line not working

Post 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#
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: ncpa command line not working

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked