Problem with NCPA and NRPD client on Windows Server in passive mode Nagios 4.5.8

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Post Reply
rafamicro
Posts: 7
Joined: Sat Nov 09, 2019 4:18 am

Problem with NCPA and NRPD client on Windows Server in passive mode Nagios 4.5.8

Post by rafamicro »

Hi, I hope someone can help me solve a problem I have with communication between a Windows Server and notifications with NRPD in passive mode. :oops: :oops:

I have a Ubuntu 24.04 Server with Nagios Version 4.5.8 installed. Communication with the NCPA agent on Windows Servers through the local network works perfectly. I am trying to configure remote Windows Servers to connect to the NCPA agent through NRPD.

Once the NRPD 2.0.5 Service is installed and configured in Nagios, it seems that the service works well, but when I configure the connection through NRPD on the remote Windows Server, I don't know why, but I don't even get any results in the file C:\Program Files\Nagios\NCPA\var\log\ncpa_passive.log, it is blank.

I have tested to see if I have communication through port 80 from this Windows Server to the NRPD service and it works.

http://IP-PUBLIC/nrdp/

For the installation of NRPD in Nagios I have followed the instructions at https://github.com/NagiosEnterprises/nrdp/ and for the configuration of host and services I have followed the steps at https://support.nagios.com/kb/article/n ... s-762.html.

I think it is some problem with the NCPA client since it seems that it does not even make any kind of connection to the NRPD service. Here is the configuration of the ncpa.cfg file of the Windows Server:

[passive]
passive agent to run
handlers = nrdp
passive check by default,
passive check config
sleep =50
logfile = var/log/ncpa_passive.log
passive checks.
checks available.

[nrdp]
parent = http://IP-PUBLIC/nrdp/
token = mytoken-nrdp
hostname = S1601
connection_timeout = 10

Please see if someone could help me solve this problem.

Thank you very much.
bbahn
Posts: 320
Joined: Thu Jan 12, 2023 5:42 pm

Re: Problem with NCPA and NRPD client on Windows Server in passive mode Nagios 4.5.8

Post by bbahn »

Hello @rafamicro,

NCPA comes packaged with nrdp and you don't need to install NRDP separately. In fact, this is likely your problem as I suspect they are interfering with each other. Installing nrdp aside from NCPA is a completely separate program, which will mean that anything you've configured on your solo-NRDP will of course not show in the NCPA passive log.

To configure NRDP with NCPA, you seem to have the correct configurations in ncpa.cfg. Have you configured any of the actual passive checks for NCPA to run? These will be located in ${ncpa/install/directory}/etc/ncpa.cfg.d/${mychecksfilename}.cfg.
There is an example.cfg with some commented out commands as examples. Note that the [passive checks] section header needs to be uncommented for the checks to be processed correctly.

I am not certain whether you can have NCPA's NRDP alongside an instance of NRDP or not, so I would recommend just using NCPA's built-in NRDP unless you have good reason not to.

Also note that the name of the check in NCPA must match EXACTLY with your Nagios passive checks or else Nagios core will not recognize them.
Actively advancing awesome answers with ardent alliteration, aptly addressing all ambiguities. Amplify your acumen and avail our amicable assistance. Eagerly awaiting your astute assessments of our advice.
rafamicro
Posts: 7
Joined: Sat Nov 09, 2019 4:18 am

Re: Problem with NCPA and NRPD client on Windows Server in passive mode Nagios 4.5.8

Post by rafamicro »

Thank you very much bbahn, that was indeed the problem, I mistakenly thought that NRDP had to be installed separately and I didn't know that it was already built in with NCPA.

I have tried to configure a host within the local network in passive mode and it worked the first time. I still have the problem when I configure a host from outside the local network.

On the Server on the local network that works well in passive mode I have this set in the ncpa.cfg configuration

parent = http://10.0.0.78/nrdp
token = my-token

On the Server that is connecting from outside I have this set in the ncpa.cfg configuration

parent = http://myserver.com/nrdp
token = my-token

I have verified that port 80 is open since I can open the Nagios administration console from this server remote.

I think the problem could be that it does not resolve the public DNS name of my Nagios Server correctly. The same thing needs to be added to some configuration file for the Apache service or somewhere else.

Could you tell me if this is the problem and how I could fix it?

Thank you very much for your help !!!!
rafamicro
Posts: 7
Joined: Sat Nov 09, 2019 4:18 am

Re: Problem with NCPA and NRPD client on Windows Server in passive mode Nagios 4.5.8

Post by rafamicro »

I just saw these errors in the ncpa_passive.log file, it seems that it is connecting correctly but for some reason it does not recognize the data that is being sent to it.

2024-12-19 22:30:34,683 passive WARNING XML returned from NRDP server (http://my-server.com/nrdp/) was malformed. Check your server address.

2024-12-19 22:30:34,683 passive WARNING Your NRDP Address should be formatted: http://[ip address]/nrdp
bbahn
Posts: 320
Joined: Thu Jan 12, 2023 5:42 pm

Re: Problem with NCPA and NRPD client on Windows Server in passive mode Nagios 4.5.8

Post by bbahn »

@rafamicro,

I think the most likely option is that something is not configured correctly and your XI server is returning an error or something which is causing your problem. I think the most likely case is that your token defined in ncpa.cfg under [nrdp] is wrong. This should not be your NCPA token, but your token from your Nagios XI server's inbound configuration. You can see more here: https://assets.nagios.com/downloads/nag ... I-2024.pdf.

If this is not the case, let me know.
Actively advancing awesome answers with ardent alliteration, aptly addressing all ambiguities. Amplify your acumen and avail our amicable assistance. Eagerly awaiting your astute assessments of our advice.
rafamicro
Posts: 7
Joined: Sat Nov 09, 2019 4:18 am

Re: Problem with NCPA and NRPD client on Windows Server in passive mode Nagios 4.5.8

Post by rafamicro »

Hi bbahn, I'm still stuck with this problem :oops: :oops: . Thanks for your interest but the documentation you sent me is for Nagios XI and I have Nagios 4.5.8 installed.

I have verified that the token I have configured in the host file in nagios is the same as the one configured in the ncpa.cfg file on the remote host.

This is the host configuration in Nagios 4.5.8

define host {
host_name SERVERBACKUP
address 192.168.30.76
check_command check_ncpa!-t 'F9AF89EA61%77' -P 5693 -M
system/agent_version
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
contacts nagiosadmin
notification_interval 60
notification_period 24x7
notifications_enabled 1
register 1
}

define service {
host_name SERVERBACKUP
service_description CPU Usage
check_command check_ncpa!-t 'F9AF89EA61%77' -P 5693 -M
cpu/percent -w 80 -c 90 -q 'aggregate=avg'
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
notification_interval 60
notification_period 24x7
contacts nagiosadmin
register 1
}

This is the configuration of the remote client's ncpa.cfg file:

# -------------------------------
# Listener Configuration (API)
# -------------------------------
#

[api]

#
# The token that will be used to log into the basic web GUI (API browser, graphs, top charts, etc)
# and to authenticate requests to the API and requests through check_ncpa.py
#
community_string =F9AF89EA61%77

#
# -------------------------------
# Passive Configuration (daemon)
# -------------------------------
#

[passive]

#
# Handlers are a comma separated list of what you would like the passive agent to run
# Default: None
# Options:
# nrdp, kafkaproducer
#
# Example:
# handlers = nrdp,kafkaproducer
#
handlers = nrdp

I'm not quite sure if the host file configuration in Nagios is correct for nrdp passive mode.

Any further help would be appreciated.

Thanks.
bbahn
Posts: 320
Joined: Thu Jan 12, 2023 5:42 pm

Re: Problem with NCPA and NRPD client on Windows Server in passive mode Nagios 4.5.8

Post by bbahn »

@rafamicro,

Your NCPA token looks correct, the problem would lie with your Nagios XI inbound token. This would be the token = under [nrdp] in your ncpa.cfg. This needs to match the token in your Nagios XI server under Admin->Check Transfers->Inbound Transfers->Authentication Tokens.

You also need to make sure that the name of the check in your NCPA passive configuration and your XI configuration match EXACTLY. Otherwise it won't work.
Actively advancing awesome answers with ardent alliteration, aptly addressing all ambiguities. Amplify your acumen and avail our amicable assistance. Eagerly awaiting your astute assessments of our advice.
rafamicro
Posts: 7
Joined: Sat Nov 09, 2019 4:18 am

Re: Problem with NCPA and NRPD client on Windows Server in passive mode Nagios 4.5.8

Post by rafamicro »

Hello, I have finally found the solution :D :D :D . I am putting it here in case someone has encountered the same problem and can solve it.

There was something that didn't fit me, since according to bbahn he said that nrdp came preinstalled with the Nagios Core 4.5.8 version, I kept seeing that if I launched the query to the URL hhtp://my-ip-public/nrdp from the client, it didn't give me a response, so I tried to install the NRDP service following the steps in this help:

https://github.com/NagiosEnterprises/nrdp/

Once I completed these steps on the client side, the nrdp portal responded to me and when I configured the NCPA client through NRDP I started to see the notifications on my Nagios Server.

I even tried to secure it via https using this help:

https://support.nagios.com/kb/article/n ... tml#Ubuntu

And after making the changes it still works fine, this time via https, in my case with a certificate from a certifying authority and not the OpenVPN example.

Anyway, thanks for the help provided by bbahn.

Now I'm at the step of being able to configure more types of notifications in the client than those that come by default:

%HOSTNAME%|CPU Usage = cpu/percent --warning 80 --critical 90 --aggregate avg
%HOSTNAME%|Disk Usage = disk/logical/C:|/used_percent --warning 80 --critical 90 --units Gi
%HOSTNAME%|Swap Usage = memory/swap --warning 60 --critical 80 --units Gi
%HOSTNAME%|Memory Usage = memory/virtual --warning 80 --critical 90 --units Gi
%HOSTNAME%|Process Count = processes --warning 900 --critical 1000

Let's see if someone could help me to be able to notify through passive nrdp notifications statuses such as that of a service, bytes of writing, bytes of reading, version of windows, updates Windows, etc.

Thanks again to anyone who can help me.
Post Reply