NCPA to Nagios XI initial connection

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
meganoliver
Posts: 6
Joined: Wed Jan 09, 2019 11:26 am

NCPA to Nagios XI initial connection

Post by meganoliver »

Once NCPA is installed on a server, can the server with NCPA send the token to be stored in the database? Or is it possible to make a call to the Nagios API from the server with NCPA to initialize the connection, which would then store the token? The idea is to avoid anyone from knowing what the token is unless authorized.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: NCPA to Nagios XI initial connection

Post by lmiltchev »

All you need to do is change the default token, aka community_string ("mytoken") in the ncpa.cfg to something more secure, and restart the NCPA services so that changes can take effect.

You could set up the token on the initial install on Windows machines, for example when using the silent installer:

Code: Select all

ncpa-<version>.exe /S /TOKEN='<new secure token>' 
https://www.nagios.org/ncpa/getting-sta ... nt-install

If NCPA is already installed, you can just modify the ncpa.cfg file in Windows.

On Linux, you could use a sed command to change the token, e.g.:

Code: Select all

sed -i 's/community_string =mytoken/community_string =MyT0k3n!/' /usr/local/ncpa/etc/ncpa.cfg
service ncpa_listener restart
service ncpa_passive restart
If you wanted to submit these commands remotely, you could use Ansible or some other method.

Hope this helps.
Be sure to check out our Knowledgebase for helpful articles and solutions!
meganoliver
Posts: 6
Joined: Wed Jan 09, 2019 11:26 am

Re: NCPA to Nagios XI initial connection

Post by meganoliver »

The token will already be changed during the install. After NCPA is installed on a server, instead of using the Nagios XI NCPA configuration wizard to connect the server to Nagios XI, is there a command to initially connect the server? Ideally a call is made from the server with NCPA to the Nagios XI API to do the initial connection.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: NCPA to Nagios XI initial connection

Post by lmiltchev »

After NCPA is installed on a server, instead of using the Nagios XI NCPA configuration wizard to connect the server to Nagios XI, is there a command to initially connect the server? Ideally a call is made from the server with NCPA to the Nagios XI API to do the initial connection.
What do you mean by saying "a command to initially connect the server" and "initial connection"? You can use 2 types of checks with NCPA - active and passive.

If you are using active checks, nagios is running the checks against the client (remote box). You can add the checks (services) by running the NCPA wizard, but also manually if you wish. You can use the REST API, or create configs manually, drop them in the /usr/local/nagios/etc/import directory, and run /usr/local/nagiosxi/scripts/reconfigure_nagios.sh script to import configs.

If you are using passive checks, then NCPA is initiating the checks (instead of nagios). The checks are run on the client, then NCPA sends the check results to the Nagios XI server. You can add passive checks by modifying the NCPA configs on the client. I don't understand what kind of "initial connection" you are talking about and how it plays a role with any of this (active and/or passive checks). Can you elaborate?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked