Setting Up NCPA for Monitoring AlmaLinux 8 in Nagios XI

Picture of Ayub Huruse
Ayub Huruse
AlmaLinux 8

Efficient server monitoring is crucial for maintaining optimal system performance and minimizing downtime. The Nagios Cross-Platform Agent (NCPA) is a lightweight, agent-based tool that simplifies real-time monitoring for Linux systems like AlmaLinux 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 walks you through the installation and configuration process of NCPA on AlmaLinux 8, enabling comprehensive system monitoring through Nagios XI.

Prerequisites

Before proceeding, ensure you have:

  • An AlmaLinux 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 AlmaLinux 8 is using the Nagios repository:

sudo rpm -Uvh https://repo.nagios.com/nagios/8/nagios-repo-8-1.el8.noarch.rpm
sudo yum update -y

After adding the repository, refresh your package list:

sudo dnf clean all
sudo dnf update -y

Step 2: Install NCPA on AlmaLinux 8

Install the NCPA agent using:

sudo dnf install ncpa -y

Verify installation:

rpm -q ncpa

Expected output: ncpa-<version>.el8.x86_64

Step 3: Configure NCPA

Edit the NCPA 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). Save and close.

Step 4: Enable and Start the NCPA Service

Ensure NCPA runs at boot and starts now:

sudo systemctl enable ncpa
sudo systemctl start ncpa
sudo systemctl status ncpa

Confirm active (running) is displayed.

Step 5: Configure Firewall Rules

If firewalld is active, open port 5693:

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

Verify:

sudo firewall-cmd --list-ports

Step 6: Test NCPA Installation

Verify access to NCPA by visiting:

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

Accept the browser’s self-signed certificate warning. Enter your API token and log in.

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

1. Log into Nagios XI.

2. Navigate to Configure > Configuration Wizards.

3. Search for and select NCPA.

NCPA 7
NCPA

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

rhel 3
AlmaLinux 8 Credentials

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

6. Apply configuration and verify data collection.

Common Issues & Fixes

NCPA Service is Not Running

Check logs:

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

Restart NCPA if needed:

sudo systemctl restart ncpa

Host Appears “Down” in Nagios XI

Check firewall rules:

sudo firewall-cmd --list-ports

Check NCPA status:

sudo systemctl status ncpa

Verify Nagios XI configuration.

Incorrect API Token Error

Ensure correct token is set in ncpa.cfg. Restart NCPA after updates:

sudo systemctl restart ncpa

Conclusion

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

For additional support:

Share: