How to Monitor Rocky Linux 9 Using NCPA with Nagios XI


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 Rocky Linux 9. 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 Rocky Linux 9, enabling comprehensive system monitoring through Nagios XI.
Prerequisites
Before proceeding, ensure you have:
- A Rocky Linux 9 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
orpermissive
(check withgetenforce
; adjust if needed)
Step 1: Install the Nagios Repository
Install the Nagios repository to access NCPA packages:
sudo rpm -Uvh https://repo.nagios.com/nagios/9/nagios-repo-9-1.el9.noarch.rpm
sudo yum update -y
Then refresh the package list:
sudo dnf clean all
sudo dnf update -y
Step 2: Install NCPA on Rocky Linux 9
Install the NCPA agent:
sudo dnf install ncpa -y
Verify the installation:
rpm -q ncpa
Expected output: ncpa-<version>.el9.x86_64
Step 3: Configure NCPA
Edit the configuration file to set your API token:
sudo nano /usr/local/ncpa/etc/ncpa.cfg
Locate:
community_string = mytoken
Replace with a strong, unique value:
community_string = Str0ngT0k3n2025
Replace mytoken
with a secure token like Str0ngT0k3n2025
. Save and exit.
Step 4: Enable and Start NCPA Service
Enable and start the NCPA service:
sudo systemctl enable ncpa
sudo systemctl start ncpa
sudo systemctl status ncpa
Ensure the output shows active (running)
.
Step 5: Configure Firewall Rules
Allow traffic to NCPA on port 5693:
sudo firewall-cmd --zone=public --add-port=5693/tcp --permanent
sudo firewall-cmd --reload
Check the rule:
sudo firewall-cmd --list-ports
Step 6: Test NCPA Installation
Visit the NCPA web interface:
https://<RockyLinux9-IP>:5693/
Accept the certificate warning. Enter your API token to log in.
Step 7: Add Rocky Linux 9 Host to Nagios XI Using NCPA Wizard
1. Log into Nagios XI.
2. Go to Configure > Configuration Wizards.
3. Choose NCPA.

4. Enter the Rocky Linux 9 server’s IP and token.

5. Click Next, choose system metrics (CPU, memory, disk, etc.).
6. Complete the wizard and apply the configuration.
Common Issues & Fixes
NCPA Not Running
Check logs:
sudo journalctl -u ncpa --no-pager | tail -20
Restart NCPA:
sudo systemctl restart ncpa
Host Appears Down in Nagios XI
Check firewall:
sudo firewall-cmd --list-ports
Verify NCPA is running:
sudo systemctl status ncpa
Incorrect API Token Error
Ensure the token matches ncpa.cfg
, then:
sudo systemctl restart ncpa
Conclusion
You have successfully installed and configured NCPA on Rocky Linux 9 for monitoring with Nagios XI. This setup allows real-time visibility and proactive performance monitoring.
For further help:
Share:
On this page
Related Articles
- Centralized Log Monitoring for AlmaLinux 9 with Nagios Log Server 2024R2: A Complete Guide
- Monitoring Pop!_OS 24.04 LTS with NCPA in Nagios XI: A Comprehensive Guide
- Monitoring Clear Linux with SNMP in Nagios XI: A Step-by-Step Guide
- Monitoring NixOS with SNMP in Nagios XI: A Step-by-Step Guide
- How to Send Logs from Kali Linux to Nagios Log Server