Check for updates using the NCPA agent

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
jakai
Posts: 21
Joined: Wed Oct 21, 2020 2:39 am

Check for updates using the NCPA agent

Post by jakai »

Hello,
How can we monitor updates on Linux servers using the NCPA agent? With the help of an NRPE agent, it was possible, but we don't want to use it now. Is there a command or plugin for this?

Thank you for your help.

In the initial configuration, only the options in the picture are offered.
You do not have the required permissions to view the files attached to this post.
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: Check for updates using the NCPA agent

Post by gsmith »

Hi

NCPA can be used to run scripts on remote systems in addition to the base set of
services it provides. You can check for scripts and plugins at:
https://exchange.nagios.org/index.php?o ... %20updates

You can also create your own. I cobbled one together from something I found online and it is attached
as check_rpm.txt. Once you download it rename it to check_rpm

Install ncpa on the machine to be monitored.
(https://www.nagios.org/ncpa/getting-started.php)
Here is the minimum you have to configure on the remote machine:
Initial Configuration on Linux
By default the token will be set to mytoken and you will want to change this right away since it allows authentication into the web GUI and access to the API. To change it, open up your NCPA configuration file /usr/local/ncpa/etc/ncpa.cfg and edit the following config section:

[api]
community_string = <your new token>
You must make sure that the community_string value is under the [api] section for it to work. After saving the changes, restart the NCPA listener service:

/etc/init.d/ncpa_listener restart
The service should stop and start without errors. You are now ready to start using NCPA.

Make sure port 5693 is open on the machine to be monitored.

Then put the script in /usr/local/ncpa/plugins on the remote machine.

Code: Select all

[root@localhost plugins]# pwd
/usr/local/ncpa/plugins
[root@localhost plugins]# ll
total 4
-rwxrwxr-x 1 apache apache 994 Nov  9 16:05 check_rpm
Next run the NCPA Configuration Wizard, I have created a video on how to do that and
have attached it as ncpa_rpm.zip.

The script will return the last item installed or updated via rpm. The first number is
the Unix timestamp. You can tweak the script in any way you please.

Give the above a try and let me know how you make out or if I sparked any
further questions.

Thanks
You do not have the required permissions to view the files attached to this post.
jakai
Posts: 21
Joined: Wed Oct 21, 2020 2:39 am

Re: Check for updates using the NCPA agent

Post by jakai »

Hello,
thank you for help. Unfortunately the plugin does not work, see the screen in the appendix.
You do not have the required permissions to view the files attached to this post.
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: Check for updates using the NCPA agent

Post by gsmith »

Hi

From a command line on your Nagios server run:

Code: Select all

curl -v telnet://XXX.XXX.XX.XXX:5693
where XXX.XXX.XX.XXX is the IP of the machine you are trying to monitor

If it comes back with:
[root@gs-rhel8-23-84 audit]# curl -v telnet://192.168.23.81:5693
* Rebuilt URL to: telnet://192.168.23.81:5693/
* Trying 192.168.23.81...
* TCP_NODELAY set
* Connected to 192.168.23.81 (192.168.23.81) port 5693 (#0)
then that means we have connectivity. Use ctrl-c to exit out of the curl command.

Next on the remote machine run:

Code: Select all

systemctl status | grep ncpa
it should come back with:
[root@localhost ~]# systemctl status | grep ncpa
│ │ └─5216 grep --color=auto ncpa
├─ncpa_listener.service
│ └─4707 /usr/local/ncpa/ncpa_listener --start
├─ncpa_passive.service
│ └─2536 /usr/local/ncpa/ncpa_passive --start
Let me know the results. Probably best to just copy/paste anything
those commands return.

Thank you
jakai
Posts: 21
Joined: Wed Oct 21, 2020 2:39 am

Re: Check for updates using the NCPA agent

Post by jakai »

Hello,
I have problem with route to nagios. I attach pictures.

How do I fix a connection?
You do not have the required permissions to view the files attached to this post.
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: Check for updates using the NCPA agent

Post by gsmith »

Hi

What operating system is on the remote machine (192.168.200.41) ?

Thanks
jakai
Posts: 21
Joined: Wed Oct 21, 2020 2:39 am

Re: Check for updates using the NCPA agent

Post by jakai »

CentOS 7
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: Check for updates using the NCPA agent

Post by gsmith »

HI

On 192.168.200.41 please run the following:

Code: Select all

sudo firewall-cmd  --add-port=5693/tcp --permanent
sudo firewall-cmd  --reload
sudo firewall-cmd --list-ports
curl -v telnet://XXX.XXX.XX.XXX:5693
If it comes back with:

Code: Select all

[root@gs-rhel8-23-84 audit]# curl -v telnet://192.168.23.81:5693
* Rebuilt URL to: telnet://192.168.23.81:5693/
* Trying 192.168.23.81...
* TCP_NODELAY set
* Connected to 192.168.23.81 (192.168.23.81) port 5693 (#0)
then that means we have connectivity. Use ctrl-c to exit out of the curl command.

Please let me know how things go.

Thanks
jakai
Posts: 21
Joined: Wed Oct 21, 2020 2:39 am

Re: Check for updates using the NCPA agent

Post by jakai »

I did as instructed, but unfortunately it didn't help. I have the same problems.
You do not have the required permissions to view the files attached to this post.
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: Check for updates using the NCPA agent

Post by gsmith »

Hi

Looks like there might be a misunderstanding on my part.

for the following assume the IPs are:
Nagios server 192.168.1.NAGIOS
machine to be monitored: 192.168.1.MONITORME


On the Nagios server (192.168.1.NAGIOS) in a CLI try:

Code: Select all

curl -v telnet://192.168.1.MONITORME:5693
note: 192.168.1.MONITORME should be the server you are trying to monitor(aka the remote machine)

If the above command doesn't work, log into 192.168.1.MONITORME (the remote machine) and run:

Code: Select all

sudo firewall-cmd  --add-port=5693/tcp --permanent
sudo firewall-cmd  --reload
sudo firewall-cmd --list-ports
Then back on the Nagios server (192.168.1.NAGIOS) try the curl command again:

Code: Select all

curl -v telnet://192.168.1.MONITORME:5693
Please capture the commands and outputs of the above.

Thank you!
Locked