Page 1 of 1

NCPA Not Working In RHEL 7

Posted: Wed Feb 19, 2020 4:38 am
by acvillaester
Hi,

I installed ncpa on 2 Rhel Servers and it doesn't work. Please see details below.

[root@xxx:/tmp ]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens192
sources:
services: dhcpv6-client ssh
ports: 5693/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
rule family="ipv4" source address="212.x.x.x/32" port port="5666" protocol="tcp" accept
rule family="ipv4" source address="10.x.x.x/32" port port="5666" protocol="tcp" accept

========================================================
[root@xxx:/tmp ]# systemctl status ncpa_listener.service
● ncpa_listener.service - LSB: This manages the NCPA Listener service
Loaded: loaded (/etc/rc.d/init.d/ncpa_listener; bad; vendor preset: disabled)
Active: active (exited) since Tue 2020-02-11 01:45:52 CET; 7min ago
Docs: man:systemd-sysv-generator(8)
Process: 17150 ExecStop=/etc/rc.d/init.d/ncpa_listener stop (code=exited, status=0/SUCCESS)
Process: 17164 ExecStart=/etc/rc.d/init.d/ncpa_listener start (code=exited, status=0/SUCCESS)

Feb 11 01:45:52 ansible.x.x systemd[1]: Stopped LSB: This manages the NCPA Listener service.
Feb 11 01:45:52 ansible.x.x systemd[1]: Starting LSB: This manages the NCPA Listener service...
Feb 11 01:45:52 ansible.x.x systemd[1]: Started LSB: This manages the NCPA Listener service.
Feb 11 01:45:52 ansible.x.x ncpa_listener[17164]: Starting NCPA Listener: [ OK ]
=======================================================

[root@x:/tmp ]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.6 (Maipo)

======================================================

[root@x:/tmp ]# getenforce
Disabled

Please help me on this. Let me know if you need any details for troubleshooting.

Thanks.

Re: NCPA Not Working In RHEL 7

Posted: Wed Feb 19, 2020 4:52 pm
by benjaminsmith
Hello @acvillaester,

Let's get this worked out for you. A few questions to help troubleshoot the issue.

1. The service is running. What error message are you getting when trying to run checks against the host from Nagios XI.

2. Did you follow our installation instructions for Red Hat?

See: NCPA Agent Instructions

3. Run a NMAP command from the XI server to the remote host, to verify if the default NCPA port is open (post output to the thread).

Code: Select all

nmap <ipaddress> -p 5693
Thanks.

Re: NCPA Not Working In RHEL 7

Posted: Fri Feb 21, 2020 3:19 am
by acvillaester
Hi,

[root@nagiosxi-t avillaester]# nmap x.x.com -p 5693

Starting Nmap 6.47 ( http://nmap.org ) at 2020-02-21 09:17 CET
Nmap scan report for x.x.com (10.x.x.x)
Host is up (0.00034s latency).
PORT STATE SERVICE
5693/tcp closed unknown
MAC Address: 00:50:56:xx:xx:xx (VMware)

Nmap done: 1 IP address (1 host up) scanned in 0.07 seconds

Please also check attached photo.

Thanks.

Re: NCPA Not Working In RHEL 7

Posted: Fri Feb 21, 2020 10:11 am
by lmiltchev
This doesn't seen right...
[root@xxx:/tmp ]# systemctl status ncpa_listener.service
● ncpa_listener.service - LSB: This manages the NCPA Listener service
Loaded: loaded (/etc/rc.d/init.d/ncpa_listener; bad; vendor preset: disabled)
Active: active (exited) since Tue 2020-02-11 01:45:52 CET; 7min ago
Docs: man:systemd-sysv-generator(8)
Process: 17150 ExecStop=/etc/rc.d/init.d/ncpa_listener stop (code=exited, status=0/SUCCESS)
Process: 17164 ExecStart=/etc/rc.d/init.d/ncpa_listener start (code=exited, status=0/SUCCESS)

Feb 11 01:45:52 ansible.x.x systemd[1]: Stopped LSB: This manages the NCPA Listener service.
Feb 11 01:45:52 ansible.x.x systemd[1]: Starting LSB: This manages the NCPA Listener service...
Feb 11 01:45:52 ansible.x.x systemd[1]: Started LSB: This manages the NCPA Listener service.
Feb 11 01:45:52 ansible.x.x ncpa_listener[17164]: Starting NCPA Listener: [ OK ]
It should say "running":
example01.PNG
How did you install NCPA - using Nagios repository or using RPM package? Did you use Ansible?

Can you run the following commands from the command line and show the output?

Code: Select all

systemctl restart ncpa_listener
systemctl restart ncpa_passive
systemctl status ncpa_listener
systemctl status ncpa_passive
systemctl list-units | grep ncpa
curl -k "https://localhost:5693/testconnect/?token=generation123"

Re: NCPA Not Working In RHEL 7

Posted: Mon Feb 24, 2020 6:25 am
by acvillaester
Hi,

Install using the following commands:
rpm -Uvh https://repo.nagios.com/nagios/7/nagios ... noarch.rpm
yum install ncpa -y

[root@ansible:/home/avillaester ]# systemctl status ncpa_listener
● ncpa_listener.service - LSB: This manages the NCPA Listener service
Loaded: loaded (/etc/rc.d/init.d/ncpa_listener; bad; vendor preset: disabled)
Active: active (exited) since Mon 2020-02-24 12:21:56 CET; 8s ago
Docs: man:systemd-sysv-generator(8)
Process: 27173 ExecStop=/etc/rc.d/init.d/ncpa_listener stop (code=exited, status=0/SUCCESS)
Process: 27186 ExecStart=/etc/rc.d/init.d/ncpa_listener start (code=exited, status=0/SUCCESS)

Feb 24 12:21:55 ansible.webbfontaine.com systemd[1]: Starting LSB: This manages the NCPA Listener service...
Feb 24 12:21:56 ansible.webbfontaine.com ncpa_listener[27186]: Starting NCPA Listener: [ OK ]
Feb 24 12:21:56 ansible.webbfontaine.com systemd[1]: Started LSB: This manages the NCPA Listener service.
[root@ansible:/home/avillaester ]# systemctl status ncpa_passive
● ncpa_passive.service - LSB: This manages the NCPA Passive service
Loaded: loaded (/etc/rc.d/init.d/ncpa_passive; bad; vendor preset: disabled)
Active: active (running) since Mon 2020-02-24 12:22:01 CET; 9s ago
Docs: man:systemd-sysv-generator(8)
Process: 27211 ExecStop=/etc/rc.d/init.d/ncpa_passive stop (code=exited, status=0/SUCCESS)
Process: 27224 ExecStart=/etc/rc.d/init.d/ncpa_passive start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/ncpa_passive.service
└─27236 /usr/local/ncpa/ncpa_passive --start

Feb 24 12:22:00 ansible.webbfontaine.com systemd[1]: Starting LSB: This manages the NCPA Passive service...
Feb 24 12:22:01 ansible.webbfontaine.com ncpa_passive[27224]: Starting NCPA Passive: [ OK ]
Feb 24 12:22:01 ansible.webbfontaine.com systemd[1]: Started LSB: This manages the NCPA Passive service.
[root@ansible:/home/avillaester ]# systemctl list-units | grep ncpa
ncpa_listener.service loaded active exited LSB: This manages the NCPA Listener service
ncpa_passive.service loaded active running LSB: This manages the NCPA Passive service
[root@ansible:/home/avillaester ]# systemctl list-units | grep ncpa
ncpa_listener.service loaded active exited LSB: This manages the NCPA Listener service
ncpa_passive.service loaded active running LSB: This manages the NCPA Passive service
[root@ansible:/home/avillaester ]# curl -k "https://localhost:5693/testconnect/?token=generation123"
curl: (7) Failed connect to localhost:5693; Connection refused

[root@ansible:/home/avillaester ]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens192
sources:
services: dhcpv6-client ssh
ports: 5693/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
rule family="ipv4" source address="212.147.49.8/32" port port="5666" protocol="tcp" accept
rule family="ipv4" source address="10.214.10.181/32" port port="5666" protocol="tcp" accept

Thanks.

Re: NCPA Not Working In RHEL 7

Posted: Mon Feb 24, 2020 9:52 am
by lmiltchev
Try temporarily stopping the firewall for troubleshooting purposes, then restart the ncpa_listener service, and check the status again. Is it running now?

Code: Select all

systemctl restart ncpa_listener
systemctl status ncpa_listener
If this doesn't help, open the ncpa.cfg file in a text editor, and enable debugging by changing this line:

Code: Select all

loglevel = info
to this:

Code: Select all

loglevel = debug
Save, exit and restart the ncpa_listener again. Test the connection:

Code: Select all

curl -k "https://localhost:5693/testconnect/?token=generation123" -v
Post the /usr/local/ncpa/var/log/ncpa_listener.log on the forum.

Re: NCPA Not Working In RHEL 7

Posted: Mon Feb 24, 2020 10:28 am
by acvillaester
Hi,

Tried to disable firewall but it still didn't work.
Here's what ncpa_listener.log contains.

[root@ansible:/usr/local/ncpa/var/log ]# tail -f /usr/local/ncpa/var/log/ncpa_listener.log
File "ncpa_listener.py", line 108, in run
File "/usr/local/lib/python2.7/site-packages/gevent/baseserver.py", line 360, in serve_forever
File "/usr/local/lib/python2.7/site-packages/gevent/baseserver.py", line 304, in start
File "/usr/local/lib/python2.7/site-packages/gevent/pywsgi.py", line 1450, in init_socket
File "/usr/local/lib/python2.7/site-packages/gevent/server.py", line 127, in init_socket
File "/usr/local/lib/python2.7/site-packages/gevent/server.py", line 138, in get_listener
File "/usr/local/lib/python2.7/site-packages/gevent/server.py", line 225, in _tcp_listener
File "/usr/local/lib/python2.7/site-packages/gevent/_socket2.py", line 107, in __init__
error: [Errno 97] Address family not supported by protocol
2020-02-24 16:27:06,831 19065 INFO stopped

Hope that helps for troubleshooting.

Thanks.

Re: NCPA Not Working In RHEL 7

Posted: Mon Feb 24, 2020 10:47 am
by lmiltchev
Are you using IPv6 only on this system? What is the value set on the "ip" line in the ncpa.cfg file - "::" or "0.0.0.0"? Normally, you would need to have:

Code: Select all

ip = 0.0.0.0
After making the changes, save the file, and restart ncpa_listener. Did the service start correctly now?

Re: NCPA Not Working In RHEL 7

Posted: Mon Feb 24, 2020 12:17 pm
by acvillaester
Hi,

Finally it worked.

Thanks for your help.

Re: NCPA Not Working In RHEL 7

Posted: Mon Feb 24, 2020 12:22 pm
by scottwilkerson
acvillaester wrote:Hi,

Finally it worked.

Thanks for your help.
Great!

Locking thread