NCPA API service endpoint issue

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Post Reply
IT_LAS
Posts: 16
Joined: Mon Dec 30, 2019 5:34 am

NCPA API service endpoint issue

Post by IT_LAS »

Hi,
I've detected that on one of our servers, after applying some pending updates, the NCPA API "service" endpoint is not listing any of the services of the server.
I've activated the log debugging at ncpa.cfg and it's not showing any errors.

Code: Select all

2024-11-22 12:03:50,478 listener INFO before_request() - request.url: https://<server_ip>:5693/api/services
2024-11-22 12:03:50,525 geventwebsocket.handler INFO ::ffff:172.16.20.32 - - [2024-11-22 12:03:50] "GET /api/services HTTP/1.1" 200 345 0.047761
2024-11-22 12:03:50,555 listener INFO before_request() - request.url: https://<server_ip>:5693/api/services
2024-11-22 12:03:50,615 geventwebsocket.handler INFO ::ffff:172.16.20.32 - - [2024-11-22 12:03:50] "GET /api/services HTTP/1.1" 200 345 0.061230
2024-11-22 12:06:27,185 listener INFO before_request() - request.url: https://<server_ip>:5693/api/services
2024-11-22 12:06:27,228 geventwebsocket.handler INFO ::ffff:172.16.20.32 - - [2024-11-22 12:06:27] "GET /api/services HTTP/1.1" 200 345 0.043489
2024-11-22 12:06:27,905 listener INFO before_request() - request.url: https://<server_ip>:5693/api/services
2024-11-22 12:06:27,962 geventwebsocket.handler INFO ::ffff:172.16.20.32 - - [2024-11-22 12:06:27] "GET /api/services HTTP/1.1" 200 345 0.058244
I've tryed updating NCPA to the 3.1.1 version and it hasn't fix this issue.

Has anyone encountered a similar issue?
bbahn
Posts: 286
Joined: Thu Jan 12, 2023 5:42 pm

Re: NCPA API service endpoint issue

Post by bbahn »

Hello @IT_LAS,

What OS are you running NCPA on? NCPA uses a difference system for getting services depending on what OS it's running on.
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.
IT_LAS
Posts: 16
Joined: Mon Dec 30, 2019 5:34 am

Re: NCPA API service endpoint issue

Post by IT_LAS »

Hi,
I'm using Ubuntu 22.
What bothers me is that I have another machine with the same characteristics and the issue doesn't happen on it.
carys
Posts: 1
Joined: Thu Nov 28, 2024 6:34 am

Re: NCPA not loading ncpa_listener and ncpa_passive

Post by carys »

I have been trying to listen to a device on another server which has ncpa installed and ncpa_listener and ncpa_passive running on old server centos 7 which work fine using passive checks.

But when I try to add the ncpa package to new server Rocky 9.5 (Blue Onyx) through website https://www.nagios.org/ncpa it has the ncpa package installed and but I can not access the gui through 127.0.0.1:5693 for example ip is different.
I am able to start the systemctl start ncpa but not the following: systemctl start ncpa_listener and systemctl start ncpa_passive and when I do a search in /etc/init.d/ncp and /usr/lib/systemd/system/ the files are not there is on sudo find / -name ncpa_listener. Ports are open fine.

Can anyone help with this
Thank you

Carys
IT_LAS
Posts: 16
Joined: Mon Dec 30, 2019 5:34 am

Re: NCPA API service endpoint issue

Post by IT_LAS »

I have been trying to listen to a device on another server which has ncpa installed and ncpa_listener and ncpa_passive running on old server centos 7 which work fine using passive checks.

But when I try to add the ncpa package to new server Rocky 9.5 (Blue Onyx) through website https://www.nagios.org/ncpa it has the ncpa package installed and but I can not access the gui through 127.0.0.1:5693 for example ip is different.
I am able to start the systemctl start ncpa but not the following: systemctl start ncpa_listener and systemctl start ncpa_passive and when I do a search in /etc/init.d/ncp and /usr/lib/systemd/system/ the files are not there is on sudo find / -name ncpa_listener. Ports are open fine.

Can anyone help with this
Thank you

Carys
This is unrelated to the OP but I think I can give you some tips.
On the newest versions of NCPA, both services (ncpa_listener and ncpa_passive) were unified in an unique service (ncpa).
Are you using firewalld to configure the firewall rules?
If so, what's the output of this command sudo firewall-cmd --list-all
Regards
bbahn
Posts: 286
Joined: Thu Jan 12, 2023 5:42 pm

Re: NCPA API service endpoint issue

Post by bbahn »

Hello @carys,

Have you verified that NCPA is running properly? By using

Code: Select all

systemctl status ncpa
(on NCPA 3. For NCPA 2, you need to specify ncpa_listener or ncpa_passive), you can verify whether NCPA is running properly. If it's running, then the issue almost certainly the firewall and if you're using firewall-cmd, you can run

Code: Select all

firewall-cmd --add-port=5693/tcp --permanent
firewall-cmd --reload
to open your firewall's 5693 port, which is the port NCPA uses by default. If you've changed this in /usr/local/ncpa/etc/ncpa.cfg, then you will need to modify the above code to open the selected port (port = under [listener] if it's set).

If your NCPA isn't working, you should note that NCPA is not officially supported on Rocky Linux at this time and there may be bugs.
If you have any errors, they will show in /usr/local/ncpa/var/log/ncpa_listener.log and /usr/local/ncpa/var/log/ncpa_passive.log. If you set loglevel = debug in /usr/local/ncpa/etc/ncpa.cfg and systemctl restart ncpa (or ncpa_listener and ncpa_passive for NCPA 2), you'll get extra debugging information in your NCPA logs.
While Nagios does not officially support Rocky with NCPA at this time, you can file an issue for any problems you encounter at https://github.com/nagiosenterprises/ncpa/issues or submit a fix to https://github.com/nagiosenterprises/ncpa/pulls and we'll do our best to fix/review and merge them, though issues for officially supported OSs will generally be prioritized.
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.
bbahn
Posts: 286
Joined: Thu Jan 12, 2023 5:42 pm

Re: NCPA API service endpoint issue

Post by bbahn »

@IT_LAS,

Can you enable loglevel = debug in /usr/local/ncpa/etc/ncpa.cfg to get more debug information? Do you have any unusual characters in your service names i.e. https://github.com/NagiosEnterprises/ncpa/issues/1221?
Is it showing this when you do your search?:

Code: Select all

{
    "processes": []
}
Are you searching for a specific service or is it the general services endpoint that's malfunctioning?
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.
IT_LAS
Posts: 16
Joined: Mon Dec 30, 2019 5:34 am

Re: NCPA API service endpoint issue

Post by IT_LAS »

It is the general services endpoint that is not working.
The machines are Ubuntu 22.
The NCPA service was working fine on both until they were rebooted.
Since then when making a request to the services endpoint, the result is:

Code: Select all

{
    "services": {}
}
It seems that the version that is installed along with Nagios Log Server (2.4.1), installed on both machines, must have some problem. I have upgraded the NCPA agent on one of the machines to 3.1.1 and it seems to be fixed.
bbahn
Posts: 286
Joined: Thu Jan 12, 2023 5:42 pm

Re: NCPA API service endpoint issue

Post by bbahn »

Good to know, thank you.

I'll let the people in charge of NLS know to make sure the version bundled with NLS is updated.
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.
Post Reply