How to Monitor Arch Linux 2023 with NCPA in Nagios XI

Picture of Ayub Huruse
Ayub Huruse
Arch Linux 2023

To ensure optimal performance and system stability, monitoring Linux servers is crucial. The Nagios Cross-Platform Agent (NCPA) simplifies the monitoring process for Arch Linux 2023, offering a versatile, agent-based solution that integrates effortlessly with Nagios XI.

This guide provides detailed instructions on how to install and configure NCPA on Arch Linux 2023, enabling you to monitor key system metrics, track resource usage, and resolve issues before they impact performance.

Note: NCPA lacks an official Arch Linux package. This guide adapts an RHEL-compatible RPM or source build, verified as of March 2025.

Prerequisite

Before proceeding, ensure you have:

  • A system running Arch Linux 2023 with root or sudo privileges.
  • Nagios XI installed and accessible, with the NCPA Wizard enabled.
  • A stable internet connection for package downloads.

Step 1: Install Required Dependencies

NCPA requires Python and additional libraries. Install them:

sudo pacman -S python python-pip openssl base-devel
pip install requests pyOpenSSL --user
  • base-devel: For building from source if needed.
  • requests, pyOpenSSL: Python modules NCPA may require.

Step 2: Download and Install NCPA

Nagios doesn’t provide an Arch-specific NCPA package, so we’ll use an RHEL 8 RPM or build from source.

Option 1: Install via RPM (Recommended)

Download the latest EL8 RPM:

cd /tmp
wget https://assets.nagios.com/downloads/ncpa/ncpa-latest-1.x86_64.rpm

Convert and install with rpm2cpio and cpio (since Arch uses pacman, not rpm):

rpm2cpio ncpa-latest-1.x86_64.rpm | cpio -idmv
sudo cp -r usr/local/ncpa /usr/local/

Note: Check nagios.com/ncpa for the latest version (e.g., replace 3.1.1).

Option 2: Build from Source (Alternative)

If the RPM fails (e.g., due to library mismatches):

cd /tmp
git clone https://github.com/NagiosEnterprises/ncpa.git
cd ncpa
sudo ./build.sh install

This installs NCPA to /usr/local/ncpa.

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 secure API token of your choice.

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

Step 4: Enable and Start the NCPA Service

The RPM/source install doesn’t create a systemd service by default. Create one:

sudo nano /etc/systemd/system/ncpa.service

Add:

[Unit]
Description=Nagios Cross-Platform Agent
After=network.target

[Service]
ExecStart=/usr/local/ncpa/ncpa_listener --config /usr/local/ncpa/etc/ncpa.cfg
Restart=always

[Install]
WantedBy=multi-user.target

Enable and start:

sudo systemctl daemon-reload
sudo systemctl enable ncpa
sudo systemctl start ncpa

Verify:

sudo systemctl status ncpa

Step 5: Configure Firewall Rule

If UFW or another firewall is enabled on your system, allow traffic on port 5693 (default NCPA port):

sudo ufw allow 5693/tcp
sudo ufw reload

For iptables, run:

sudo iptables -I INPUT -p tcp --dport 5693 -j ACCEPT
sudo iptables-save > /etc/iptables/iptables.rules

Confirm firewall rules:

sudo iptables -L -n

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 Arch Linux 2023 Host to Nagios XI Using NCPA Wizard

1. Log in to Nagios XI.

2. Navigate to Configure > Run a configuring wizard.

Screenshot 2025 03 12 083824 2
Configuration Wizards

3. Search for and select NCPA.

NCPA 1
NCPA

4. Enter the Arch Linux 2023 server’s IP address and API token.

Screenshot 2025 03 17 113149
Arch Linux 2023 credentials

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 ufw status
  • 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 Arch Linux 2023 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: