How to Install and Configure NCPA on CentOS Stream 9 for Nagios XI Monitoring

Picture of Ayub Huruse
Ayub Huruse
CentOS 9

The Nagios Cross-Platform Agent (NCPA) is a versatile, open-source monitoring tool that simplifies system tracking across multiple platforms, including CentOS Stream 9. By integrating NCPA with Nagios XI, administrators can gain real-time insights into critical system metrics—such as CPU, memory, and disk usage—while efficiently managing services and processes from a centralized dashboard. This guide provides a step-by-step walkthrough for installing and configuring NCPA on CentOS Stream 9 and seamlessly integrating it with Nagios XI to ensure proactive and reliable system monitoring.

Prerequisites

Before proceeding, ensure the following requirements are met:

  • A running Nagios XI server, accessible from your CentOS machine.
  • A CentOS Stream 9 system with sudo or root privileges.
  • A stable internet connection for downloading NCPA.
  • Basic familiarity with Linux commands (optional but recommended).”

Step 1 – Download and Install NCPA

You can install NCPA on CentOS Stream 9 using either a direct RPM download or the official Nagios repository. Choose one method below:

1. Open a terminal and switch to a temporary directory:

cd /tmp

2. Download the latest NCPA package:

curl -O https://assets.nagios.com/downloads/ncpa/ncpa-3.0.0.el9.x86_64.rpm

Note: Visit Nagios Downloads for the latest version if 3.0.0 is outdated.

3. IInstall the package with dnf:

sudo dnf install ./ncpa-3.0.0.el9.x86_64.rpm -y  

Option 2: Nagios Repository

The Nagios repository provides an online installation method for NCPA and Nagios XI, ensuring access to the latest versions and updates.

1. Add the Nagios repository for CentOS Stream 9:

sudo rpm -Uvh https://repo.nagios.com/nagios/9/nagios-repo-9-2.el9.noarch.rpm

This configures your system to use the Nagios repo at https://repo.nagios.com/nagios, secured with public GPG keys (GPG-KEY-NAGIOS-V3 or GPG-KEY-NAGIOS-V2).

2. Install prerequisites for compatibility:

sudo yum install epel-release -y  
sudo dnf config-manager --set-enabled crb  

These enable the EPEL repository and the CRB (CodeReady Builder) repository, required for Nagios dependencies on CentOS Stream 9.

3. Update the package cache:

sudo yum update -y

4. Install NCPA:

sudo yum install ncpa -y  

Note: To upgrade NCPA later, run sudo yum update ncpa.

Verification (Both Methods)

5. Confirm installation:

ncpa --version  

Expect output like NCPA 3.0.0 (version may vary based on the source).

Step 2 – Configure NCPA

Next, configure NCPA for secure operation:

1. Open the configuration file in a text editor:

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

2. Set a secure token in the [api] section:

[api] 
community_string = your_secure_token

Replace X7kP9mNq2v with your own secure token (avoid simple strings like password).

3. In the [listener] section, ensure NCPA listens on all interfaces:

[listener]  
ip = 0.0.0.0  
port = 5693  

4. Save (Ctrl+O, Enter, Ctrl+X in nano) and backup the original:

sudo cp /usr/local/ncpa/etc/ncpa.cfg /usr/local/ncpa/etc/ncpa.cfg.bak  

Step 3 – Start and Enable NCPA Services

1. To ensure NCPA runs at startup, enable and start the services:

systemctl start ncpa_listener
systemctl start ncpa_passive
systemctl enable ncpa_listener
systemctl enable ncpa_passive

2. Verify they’re running:

sudo systemctl status ncpa_listener  
sudo systemctl status ncpa_passive  

Look for Active: active (running) in the output.

Step 4 – Configure Firewall Rules

1. Allow NCPA traffic through the firewall and Reload the firewall:

firewall-cmd --permanent --add-port=5693/tcp
firewall-cmd --reload

2. Confirm the rule:

sudo firewall-cmd --list-all

Ensure 5693/tcp appears under ports.

Step 5 – Integrate NCPA with Nagios XI

Integrate NCPA with Nagios XI for centralized monitoring:

1. Launch the NCPA Wizard

  • Log in to your Nagios XI web interface.
  • Navigate to Configure > Configuration Wizards.
  • Select NCPA Monitoring.
Screenshot 2025 03 13 123516
NCPA

2. Enter Connection Details

  • Input the CentOS server’s IP address (e.g., 192.168.1.100).
  • Enter the API token from ncpa.cfg (e.g., X7kP9mNq2v).
  • Set the port to 5693.
  • Click Next.
Screenshot 2025 03 13 123617
NCPA Config

3. Choose Metrics

  • Select services to monitor (e.g., CPU Usage, Memory Usage, Disk Space, Network Statistics).
  • Customize thresholds if needed, then click Next.

4. Apply and Verify

  • Finish the wizard and apply the configuration.
  • Check Core Config Manager > Monitoring > Service Status to confirm data is flowing.

Troubleshooting Common NCPA Issues

Resolve common NCPA setup problems with these tips:

  1. NCPA Services Won’t Start
    • Symptom: systemctl status ncpa_listener shows Active: failed.
    • Fix: Check logs (journalctl -u ncpa_listener), ensure /usr/local/ncpa/etc/ncpa.cfg syntax is correct, or reinstall (e.g., sudo yum reinstall ncpa for repo method).
  2. Nagios XI Shows No Data
    • Symptom: No metrics in Service Status.
    • Fix: Test connectivity (curl -k https://<server-ip>:5693 from Nagios XI), verify token and port match ncpa.cfg.
  3. Firewall Blocks Access
    • Symptom: Connection timeouts from Nagios XI.
    • Fix: Confirm 5693/tcp is open (sudo firewall-cmd –list-all); reapply rules if needed.

Conclusion

By following this guide, you have successfully installed NCPA on CentOS Stream 9 and integrated it with Nagios XI. This setup allows comprehensive system monitoring and ensures proactive alerting for critical system metrics.

For further details, refer to the official NCPA documentation.

Share: