How to Monitor RHEL 8 Using NCPA with Nagios XI

Picture of Ayub Huruse
Ayub Huruse
Monitor RHEL 8

Efficient server monitoring is crucial for maintaining optimal system performance and preventing potential issues before they escalate. The Nagios Cross-Platform Agent (NCPA) is a lightweight, agent-based tool that simplifies real-time monitoring for Linux systems like Red Hat Enterprise Linux (RHEL) 8. Unlike SNMP, NCPA leverages a secure, RESTful API to collect detailed system metrics, making it a powerful and secure monitoring solution for integration with Nagios XI. This guide will walk you through the installation and configuration process of NCPA on RHEL 8, enabling you to monitor your system comprehensively through Nagios XI.

Prerequisites

Before proceeding, ensure you have:

  • A RHEL 8 system with root or sudo privileges.
  • Nagios XI installed and accessible, with the NCPA Wizard enabled.
  • A stable internet connection for package downloads.
  • SELinux set to `enforcing` or `permissive` (check with `getenforce`; adjust if needed).

Step 1: Install the Nagios Repository

The recommended method for installing NCPA on RHEL 8 is using the Nagios repository. To add the repository, run:

sudo rpm -Uvh https://repo.nagios.com/nagios/8/nagios-repo-8-2.el8.noarch.rpm

After adding the repository, update your package list:

sudo dnf clean all
sudo dnf update -y

Step 2: Install NCPA on RHEL 8

Once the repository is configured, install the NCPA agent using:

sudo dnf install ncpa -y

Verify the installation:

rpm -q ncpa

Expected output: ncpa-<version>.el8.x86_64 (e.g., ncpa-3.1.1-1.el8.x86_64).

Step 3: Configure NCPA

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

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

Find the line:

community_string = mytoken

Replace mytoken with a strong, unique token (e.g., K9pL3mX7vR2tQ8nJ), avoiding predictable values for security.

Save the file (CTRL + X, then Y, and Enter).

Step 4: Enable and Start the NCPA Service

To ensure NCPA runs automatically at boot and starts immediately, run:

sudo systemctl enable ncpa
sudo systemctl start ncpa

Check if the service is running:

sudo systemctl status ncpa

Confirm Active: active (running) appears in the output.

Step 5: Configure Firewall Rules

If firewalld is active (check with sudo systemctl status firewalld), allow NCPA traffic on port 5693:

sudo firewall-cmd --zone=public --add-port=5693/tcp --permanent
sudo firewall-cmd --reload

Confirm firewall rules:

sudo firewall-cmd --list-ports

Step 6: Test NCPA Installation

After configuring the firewall, confirm that NCPA is accessible by navigating to:

https://<NCPA_IP_Address>:5693/

Since NCPA uses a self-signed certificate, your browser may display a warning. Click Advanced > Proceed to continue.

You should see the NCPA login page. Enter the API token you configured earlier and click Log In.

Step 7: Add RHEL 8 Host to Nagios XI Using NCPA Wizard

1. Log in to Nagios XI.

2. Navigate to Configure > Configuring wizard.

XI Configure to Wizard 1
Configuration wizards

3. Search for and select NCPA.

Screenshot 2025 03 13 123516 Copy
NCPA

4. Enter the RHEL 8 server’s IP address and API token.

Screenshot 2025 03 14 113713
NCPA Config step 1

5. Click Next, select the system metrics to monitor (CPU, memory, disk, network traffic, etc.).

6. Apply the configuration and verify that Nagios XI is collecting data.

    Common Issues & Fixes

    NCPA Service is Not Running

    Check logs for errors:

    sudo journalctl -u ncpa --no-pager | tail -20

    Restart NCPA if necessary:

    sudo systemctl restart ncpa

    Host Appears “Down” in Nagios XI

    • Check firewall rules:
    sudo firewall-cmd --list-ports
    • Ensure NCPA is running:
    sudo systemctl status ncpa
    • Verify Nagios XI configuration

    Incorrect API Token Error

    • Confirm the correct API token is set in ncpa.cfg
    • Restart the NCPA service after changes

    Conclusion

    You have successfully installed and configured NCPA on RHEL 8 for monitoring with Nagios XI. This setup allows efficient tracking of system performance metrics and ensures proactive issue resolution.

    For further assistance, refer to the Nagios Support Forum or the Nagios Knowledgebase.

    Share: