Step-by-Step Guide: Monitoring Ubuntu 20.04 with NCPA in Nagios XI

Picture of Ayoub Louragli
Ayoub Louragli
ubuntu 20.04

Effective system monitoring is vital for ensuring optimal performance and identifying issues early. The Nagios Cross-Platform Agent (NCPA) offers a lightweight, secure, and modern method for monitoring Linux systems like Ubuntu 20.04. Unlike traditional tools such as SNMP, NCPA uses a RESTful API and provides detailed system metrics through an easy-to-use interface. This guide walks you through the installation and configuration of NCPA on Ubuntu 20.04, enabling full integration with Nagios XI.

Prerequisites

Before you begin, ensure you have:

  • A system running Ubuntu 20.04 or newer with root/sudo access
  • Nagios XI installed and accessible (with the NCPA wizard enabled)
  • Network connectivity between the Ubuntu host and Nagios XI
  • A stable internet connection for package installation

Step 1: Install the Nagios Repository

The recommended method is to install NCPA using the Nagios repository:

echo "deb https://repo.nagios.com/deb/$(lsb_release -cs) /" | sudo tee /etc/apt/sources.list.d/nagios.list
wget -qO - https://repo.nagios.com/GPG-KEY-NAGIOS-V3 | sudo apt-key add -
sudo apt update

Step 2: Install NCPA on Ubuntu 20.04

Install the NCPA agent:

sudo apt install ncpa -y

Alternatively, download and install the DEB package manually:

cd /tmp
wget https://assets.nagios.com/downloads/ncpa3/ncpa-latest.amd64.deb
sudo dpkg -i ncpa-latest.amd64.deb
sudo apt-get install -f

Verify installation:

ncpa --version

Step 3: Configure NCPA

Set your API token by editing the config file:

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

Find the line:

community_string = mytoken

Replace mytoken with a strong, unique token (e.g., K9pL3mX7vR2tQ8nJ). Save and close.

Step 4: Enable and Start the NCPA Service

Ensure NCPA runs at boot and is currently active:

sudo systemctl enable ncpa
sudo systemctl restart ncpa
sudo systemctl status ncpa

Check for active (running) status.

Step 5: Configure Firewall Rules

If using UFW, open port 5693:

sudo ufw allow 5693/tcp
sudo ufw reload
sudo ufw status

Step 6: Test NCPA Installation

Visit the NCPA interface in your browser:

https://<Ubuntu-IP>:5693/

Accept the browser’s self-signed certificate warning. Enter your token and verify the dashboard loads.

Step 7: Add Ubuntu Host to Nagios XI Using NCPA Wizard

1. Log into Nagios XI.

2. Navigate to Configure > Configuration Wizards.

3. Select NCPA.

NCPA 8
ncpa wizard

4. Enter the Ubuntu system’s IP address and API token.

5. Choose which services to monitor (CPU, memory, disk, etc.).

6. Apply configuration and confirm data collection.

    Common Issues & Fixes

    NCPA Service Not Running

    • Check logs: sudo journalctl -u ncpa --no-pager | tail -20
    • Restart service: sudo systemctl restart ncpa

    Host Appears “Down” in Nagios XI

    • Confirm firewall is open on port 5693
    • Verify NCPA is running
    • Recheck Nagios XI host and service definitions

    Incorrect API Token

    • Ensure the correct token is set in ncpa.cfg
    • Restart NCPA after updating the token: sudo systemctl restart ncpa

    Conclusion

    You have now installed and configured NCPA on Ubuntu 20.04 and integrated it with Nagios XI for comprehensive system monitoring. This setup provides a secure and powerful way to track server performance and gain operational visibility.

    For Additional Help

    Share: