Monitoring RHEL 7 with NCPA in Nagios XI: A Complete Guide

Picture of Ayub Huruse
Ayub Huruse
RHEL 7

Ensuring the health and stability of your RHEL 7 servers is vital for seamless IT operations. The Nagios Cross-Platform Agent (NCPA) offers a modern, agent-based approach to monitoring, providing real-time insights into critical system metrics such as CPU usage, memory utilization, disk space, and network activity. Unlike traditional SNMP-based monitoring, NCPA leverages a secure RESTful API for enhanced data collection and integration with Nagios XI.

This step-by-step guide will walk you through installing and configuring NCPA on RHEL 7, ensuring seamless monitoring and proactive issue resolution with Nagios XI.

Prerequisites

Before proceeding, ensure you have:

  • A RHEL 7 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 7 is using the Nagios repository. To add the repository, run:

sudo rpm -Uvh https://repo.nagios.com/nagios/7/nagios-repo-7-2.el7.noarch.rpm
sudo yum update -y

After adding the repository, update your package list to ensure you have access to the latest packages.

Step 2: Install NCPA on RHEL 7

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

sudo yum install ncpa -y

Verify the installation by checking the package version:

rpm -q ncpa

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

Step 3: Configure NCPA

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

1. Open the configuration file:

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

2. Locate the line:

 community_string = mytoken

3. Replace mytoken with a strong, unique token (e.g., K9pL3mX7vR2tQ8nJ) to enhance security.

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

Step 4: Enable and Start the NCPA Service

Ensure NCPA runs automatically at boot and starts immediately by executing:

sudo systemctl enable ncpa
sudo systemctl start ncpa

Check the service status to confirm it is active:

sudo systemctl status ncpa

You should see Active: active (running) 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 the firewall rules with:

sudo firewall-cmd --list-ports

Step 6: Test NCPA Installation

After configuring the firewall, confirm that NCPA is accessible:

1. Open a web browser and navigate to:

https://<NCPA_IP_Address>:5693/

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

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

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

1. Log in to Nagios XI.

2. Navigate to Configure > Run a Configuration Wizard.

3. Search for and select NCPA.

NCPA 5
NCPA

4. Enter the RHEL 7 server’s IP address and the API token you set in the NCPA configuration.

rhel 1
RHEL 7 Credentials

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

6. Apply the configuration and verify that Nagios XI is collecting data from your RHEL 7 host.

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 for proper IP and token settings.

Incorrect API Token Error

  • Confirm the correct API token is set in /usr/local/ncpa/etc/ncpa.cfg.
  • Restart the NCPA service after making changes.

Conclusion

You have successfully installed and configured NCPA on RHEL 7 for monitoring with Nagios XI. This setup enables efficient tracking of system performance metrics and ensures proactive issue resolution through real-time monitoring. For further assistance, refer to the Nagios Support Forum or the Nagios Knowledgebase.

Share: