How to Integrate NCPA for Kali Linux with Nagios XI


Integrating NCPA (Nagios Cross-Platform Agent) on Kali Linux with Nagios XI allows you to monitor critical system metrics like CPU usage, memory, disk space, and custom scripts. This setup ensures optimal performance and helps identify issues early. Follow this step-by-step guide to configure NCPA on your Kali Linux system for seamless monitoring with Nagios XI.
Prerequisites
Key factors before beginning the guide:
- A system running Kali Linux
- Nagios XI instance to access the web interface
- Root or sudo access for advanced operations
- Internet access to download packages
Step 1: Download NCPA
First, you need to install the NCPA agent on your Kali Linux machine. You can download the NCPA package from the Nagios website and use the DEB file to download that is based on Debian.

Open your terminal and update your packages.
sudo apt update
Use wget and curl to put the URL for the NCPA link that you downloaded from the Nagios website.
wget https://assets.nagios.com/downloads/ncpa3/ncpa-latest-1.amd64.deb
curl -LO https://assets.nagios.com/downloads/ncpa3/ncpa-latest-1.amd64.deb
Step 2: Install NCPA
Use the dpkg command to install the package of the downloaded DEB package.
sudo dpkg -i ncpa-latest-1.amd64.deb
If you encounter dependency issues, you might need to run this command.
sudo apt-get install -f
Step 3: Configure NCPA
After installation, configure the NCPA agent by editing the ncpa.cfg file, typically located in /usr/local/ncpa/etc/. Set the necessary parameters, such as the token for authentication.
sudo nano /usr/local/ncpa/etc/ncpa.cfg
Find the line that says community_string and set it to a secure token by changing mytoken to your unique token under the [listener] section.
community_string = mytoken

After making this change, save and close the file.
Step 4: Start and Enable NCPA
Restart and enable NCPA service to start automatically at boot.
sudo systemctl restart ncpa
sudo systemctl enable ncpa
Step 5: Allow NCPA Port in Firewall
If your firewall is enabled, you’ll need to allow traffic on port 5693 using ufw.
sudo ufw allow 5693/tcp
sudo ufw reload
Step 6: Test NCPA on the web interface
Test the NCPA functionally by visiting the NCPA web interface via a browser to see if it is working. Enter the URL from the address bar and change NCPA_IP_Address to your Kali Linux IP address or use 0.0.0.0. Furthermore, 5693 is the default port number.
https://<NCPA_IP_Address>:5693/
There will be a security popup when you’re trying to access the NCPA webpage; you can skip this by clicking Advanced and then clicking Accept the Risk and Continue.

Login to the NCPA web GUI by using your token you used for your community string.

Once you’ve logged in, you can use the NCPA web interface to check out the various functionality for monitoring your Kali Linux system.

Step 7: Configure NCPA to Nagios XI
Use your Nagios XI server to log in to the web interface.

Navigate to the Configure tab from the gear icon to the Configuration Wizards page and look for Linux Server to incorporate the NCPA monitoring on Nagios XI.

Configure your NCPA wizard by provide the IP address from your Kali Linux machine and the token for the authentication that you configured earlier.

Set up the rest of the configuration by selecting the specific checks you want to perform on your Kali Linux machine, such as CPU usage, memory usage, disk space, and more.

Finish the wizard by applying the configuration and saving the changes to start monitoring your Kali Linux device.
Step 8: Verify your Status
Verify the status of your NCPA monitoring by navigating to the status page on your home dashboard. This will allow you to check if the NCPA agent is running correctly on your Kali Linux machine within Nagios XI.

Troubleshooting
If you have any issues setting up NCPA for Kali Linux, here is a list of what to troubleshoot.
Connection Issues
- Verify that the NCPA service is running on the Kali Linux machine.
- Check the firewall settings on both the Kali Linux machine and any network firewalls.
- Ensure that the Nagios XI server can reach the Kali Linux machine on port 5693.
- Test the connection from the Nagios XI server using telnet 5693.
Authentication Issues
- Double-check the password you entered in the Nagios XI wizard.
- Verify that the password in /etc/ncpa.cfg matches the password you entered in Nagios XI.
Check Errors
- Check the NCPA logs on the Kali Linux machine for any errors (/var/log/ncpa_listener.log).
- Run the NCPA checks manually on the Kali Linux machine to verify that they are working correctly.
- Example:
/usr/local/ncpa/plugins/check_ncpa.py -H 127.0.0.1 -t '' -M 'cpu/percent'
Plugin Permissions
- Ensure that the Nagios user on the Nagios XI server has the correct permissions to execute the NCPA plugins.
Conclusion
By following these instructions, you should be able to successfully integrate NCPA on Kali Linux with Nagios XI, enabling effective system monitoring. This setup will help you track vital metrics, ensure optimal performance, and address potential issues promptly. If you have additional questions or other support-related questions, please visit us at our Nagios Support Forum, Nagios Knowledge Base, or Nagios Library.