Table of Contents

How to Install Nagios Cross Platform Agent (NCPA) on Ubuntu 24.04 LTS

Picture of Ayub Huruse
Ayub Huruse

The Nagios Cross Platform Agent (NCPA) offers a seamless way to monitor systems across different operating systems. This guide outlines how to install and configure NCPA on Ubuntu 24.04 LTS versions.

Prerequisites

Before beginning the installation, ensure the following requirements are met:

  • A system running Ubuntu 24.04 LTS
  • Root or sudo privileges
  • Stable internet connection
  • Verify your Ubuntu version by running the command: lsb_release -a
lsb_release -a

Example output:

output of the Ubuntu Version.
output of the Ubuntu Machine.

Step 1: Download the NCPA Package

To download the latest NCPA package for your Ubuntu system, open a terminal and run:

wget https://assets.nagios.com/downloads/ncpa3/ncpa-latest-1.amd64.deb

Step 2: Install the NCPA Package

Once the package is downloaded, install it using the following command:

sudo dpkg -i ncpa-latest-1.amd64.deb

If you encounter dependency errors, resolve them by running:

sudo apt-get install -f

Step 2 (Alternative): Installing NCPA via Repository (Preferred Method)

Alternatively, you can install NCPA via the Nagios repository. To check the compatible Ubuntu
versions for NCPA, visit the following link: Compatible Ubuntu Versions with NCPA

To install NCPA via the Nagios repository:

1. Add the Nagios repository:

echo "deb https://repo.nagios.com/deb/$(lsb_release -cs) /" > /etc/apt/sources.list.d/nagios.list

2. Add the public GPG key:

wget -qO - https://repo.nagios.com/GPG-KEY-NAGIOS-V3 | sudo apt-key add -

3. Update your apt repositories:

sudo apt-get update

4. Install NCPA:

sudo apt-get install ncpa

Step 3: Configure NCPA

After installation, configure NCPA by editing the configuration file to set your API token:

sudo nano /usr/local/ncpa/etc/ncpa.cfg

Locate the line:

community_string = mytoken

Example Output:

Example of the Community_string.
Example of the Community_string.

Replace mytoken with a secure API token of your choice. Save the file (CTRL + X, then Y and Enter).

Step 4: Restart NCPA Service

To apply the changes, restart the NCPA service:

sudo systemctl restart ncpa

Step 5: Configure Firewall (if enabled)

If you have a firewall enabled on your system, you will need to allow traffic on port 5693, which is used
by NCPA. For Ubuntu systems, follow these steps to configure UFW (Uncomplicated Firewall) and
allow NCPA:

1: Create the necessary directory for UFW application profiles:

sudo mkdir -p /etc/ufw/applications.d

2: Create and configure a custom application profile for NCPA:

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"

3: Allow the NCPA service through the firewall:

sudo ufw allow NCPA

4: Reload the firewall to apply changes:

sudo ufw reload

Troubleshooting: Firewall Not Enabled

If the firewall is inactive, enable it:

1: Check the current firewall status:

sudo ufw status

2: If inactive, enable it:

sudo ufw enable

3: Reload firewall rules:

sudo ufw reload

Here is how it should look after you successfully enable the firewall:

Screenshot 2025 01 20 161840 1
Output of the enabled firewall.

Step 6: Test NCPA Installation

  1. Open a web browser and navigate to: https://<NCPA_IP_Address>:5693/
  2. Bypass the security warning due to self-signed certificates by clicking Advanced and selecting Proceed.
Screenshot 2025 01 20 152254 1
Bypas the security Example.

3. On the NCPA login page, enter the API token you configured earlier and click Log In.

Screenshot 2025 01 20 152346 1
Login screen Example.

4. Upon successful login, you will be directed to the NCPA Dashboard.

Screenshot 2025 01 20 133847 1
NCPA Dashboard Example.

Configuring Nagios XI

To monitor the Ubuntu server using Nagios XI and the NCPA agent, follow these steps:

  1. Navigate to the Nagios XI dashboard.
  2. Open the NCPA wizard by selecting Configure > Run a Monitoring Wizard > NCPA.
  3. Enter the required details, including the IP address of the server and the API token you configured during NCPA setup.
  4. Complete the wizard setup and apply configuration changes.
Screenshot 2025 01 20 100524 1
A screenshot of the NCPA wizard being run with data entered

Verifying Monitoring Setup

  1. After completing the wizard, Nagios XI should display the monitored host and its services.
  2. Navigate to the Service Status page to confirm that the system is being monitored.
Screenshot 2025 01 20 100617
A screenshot of the host being monitored in XI after the wizard is run and the system is being monitored.

For more detailed instructions, refer to the Nagios XI Documentation.

Step 7: Configure Nagios XI (Optional)

Refer to the official Nagios XI documentation for detailed instructions on configuring Nagios XI to monitor servers using NCPA: Monitoring Devices Using The NCPA Agent And Nagios XI

Conclusion

By following this guide, you have successfully installed and configured the Nagios Cross Platform Agent on your Ubuntu system. If you encounter any issues, refer to the Nagios Support Forum or the Nagios Knowledge Base for further assistance.

Share this post