Page 1 of 4

Check for updates using the NCPA agent

Posted: Tue Nov 09, 2021 9:18 am
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.

Re: Check for updates using the NCPA agent

Posted: Tue Nov 09, 2021 4:50 pm
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

Re: Check for updates using the NCPA agent

Posted: Wed Nov 10, 2021 6:11 am
by jakai
Hello,
thank you for help. Unfortunately the plugin does not work, see the screen in the appendix.

Re: Check for updates using the NCPA agent

Posted: Wed Nov 10, 2021 3:34 pm
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

Re: Check for updates using the NCPA agent

Posted: Thu Nov 11, 2021 4:18 am
by jakai
Hello,
I have problem with route to nagios. I attach pictures.

How do I fix a connection?

Re: Check for updates using the NCPA agent

Posted: Thu Nov 11, 2021 2:18 pm
by gsmith
Hi

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

Thanks

Re: Check for updates using the NCPA agent

Posted: Sat Nov 20, 2021 2:35 am
by jakai
CentOS 7

Re: Check for updates using the NCPA agent

Posted: Mon Nov 22, 2021 10:07 am
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

Re: Check for updates using the NCPA agent

Posted: Fri Nov 26, 2021 4:16 am
by jakai
I did as instructed, but unfortunately it didn't help. I have the same problems.

Re: Check for updates using the NCPA agent

Posted: Mon Nov 29, 2021 4:15 pm
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!