Share this post
Louie Mattia
Table of Contents
How to Monitor an Debian Device with NCPA
|
Louie Mattia
![](https://library.nagios.com/wp-content/uploads/2025/02/download.jpg)
This guide will show you two methods to install the Nagios Cross-Platform Agent (NCPA) on your Debian 10 system. It’s essential to have root privileges to execute the necessary commands, so I recommend using sudo -i
to switch to the root user before proceeding.
Step 1 Method 1: Installing via the Repository (Recommended)
The preferred method for installing NCPA is through the repository. This approach involves a series of simple steps that can all be executed from the command line.
Add the Nagios repository to your sources list: To do this, execute the following command:
echo "deb https://repo.nagios.com/deb/$(lsb_release -cs) /" > /etc/apt/sources.list.d/nagios.list
This command will add the repository to your system, ensuring you have access to the NCPA package.
Add the GPG key for the repository: The GPG key is required to verify the integrity of the packages you’ll download. You might encounter a warning saying that the command used is deprecated, but don’t worry—it will still function correctly. To add the GPG key, use:
wget -qO - https://repo.nagios.com/GPG-KEY-NAGIOS-V3 | apt-key add -
If successful, you should see the message OK
, confirming the key was added correctly.
Update your package list: Now that the repository and key are set up, update your package lists:
apt-get update
Install the NCPA package: With the update complete, you can now install NCPA using the following command:
apt-get install ncpa
![How to Monitor an Debian Device with NCPA 1 Screenshot 2025 02 14 142214](https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-14-142214.png)
Step 2: Configure NCPA
After installing NCPA, the agent will work out of the box, but it’s highly recommended to configure the API token for added security. Without this step, the default token will be used, which might not be ideal for your environment. Enter the following into your command line:
sudo nano /usr/local/ncpa/etc/ncpa.cfg
In the configuration file, look for the line that reads: community_string = mytoken.
![How to Monitor an Debian Device with NCPA 2 Screenshot 2025 02 14 142448](https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-14-142448.png)
Replace mytoken
with a secure token of your choice. After updating the token, press CTRL + X
, then press Y
to confirm the changes, and hit Enter
to save the file. We want to use the token we made so there is one final step, which is to restart our NCPA. At the moment its API token that will be accepted is still the default token. We want it to use the newly created one. To do this we enter the following command:
systemctl restart ncpa
This will restart the service, and NCPA will now use the newly configured token.
Step 3: Configuring Firewall
If you’re running a firewall on your system, you’ll need to allow traffic on port 5693, which is used by NCPA. For Ubuntu systems with UFW (Uncomplicated Firewall) enabled, follow these steps to configure the firewall and allow NCPA traffic:
Create the directory for UFW application profiles: First, create the necessary directory where UFW can store application profiles:
sudo mkdir -p /etc/ufw/applications.d
Create a custom application profile for NCPA: Next, set up a custom profile for NCPA by running the following commands:
sudo sh -c "echo '[NCPA]' > /etc/ufw/applications.d/ncpa"
sudo sh -c "echo 'title=Nagios Cross Platform Agent' >> /etc/ufw/applications.d/ncpa"
sudo sh -c "echo 'description=Nagios Monitoring Agent' >> /etc/ufw/applications.d/ncpa"
sudo sh -c "echo 'ports=5693/tcp' >> /etc/ufw/applications.d/ncpa"
Allow NCPA traffic through the firewall: Once the profile is set up, allow NCPA through the firewall with:
sudo ufw allow NCPA
Reload the firewall to apply the changes: Finally, reload UFW to apply the changes:
sudo ufw reload
Step 4(Optional): Confirm NCPA installation
This step is straightforward. Simply open a web browser and navigate to https://<host-ip-address>:5693
.
![How to Monitor an Debian Device with NCPA 3 Screenshot 2025 02 05 101958](https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-05-101958-1024x235.png)
This will bring you to the login page, where you can enter your token. The purpose of this step is to verify that the NCPA is up and running, that it is reading the token correctly, and that remote access is functional.
Step 5: Configuring on Nagios XI
The final step involves configuring Nagios XI. To do this, navigate to the Configuration Wizards section in Nagios and select the NCPA Wizard.
- Navigate to the Configuration Wizards section in Nagios XI and select the NCPA Wizard.
- Enter the necessary information, including the IP address, the token, and the system type (Ubuntu in this case).
- During the setup, you will be prompted to choose a name for your host and select the services you want to monitor with NCPA.
Once the setup is complete, the new host will appear in your monitoring dashboard. You can navigate to the Host Status section to confirm that it is being monitored properly.
![How to Monitor an Debian Device with NCPA 4 Screenshot 2025 02 14 153707](https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-14-153707-1024x482.png)
Conclusion
By following this guide, you have successfully installed and configured the Nagios Cross-Platform Agent (NCPA) on Debian 10. You are now able to monitor the system using Nagios XI. If any issues are encountered, we recommend using the Nagios Support Forum.