Installing Nagios Cross-Platform Agent on Fedora 39 Workstation

Picture of Johnny Mengistu
Johnny Mengistu
Fedora 39 logo on a hexagon gradient blue and green background.

Nagios is a popular open-source monitoring system that helps in tracking the status of various network services, servers, and other systems in an IT infrastructure. To extend Nagios’ functionality to non-Linux systems or to gain deeper insights into systems beyond basic SNMP or HTTP checks, you can use Nagios Cross-Platform Agent (NCPA).

In this article, we will walk through the process of installing and configuring NCPA on a Fedora 39 workstation. This allows your system to communicate with the Nagios monitoring server, reporting on its health, system performance, and other monitored services.

Prerequisites

Before we start, ensure that you have:

  1. A Fedora 39 workstation up and running.
  2. Root or sudo privileges on the machine.
  3. Internet access to download necessary packages.
  4. A basic understanding of Linux commands and networking.

Steps to Install Nagios Cross-Platform Agent on Fedora 39 Workstation

Step 1: Install Required Dependencies

First, ensure that your system is up-to-date and has all the required dependencies to install Nagios NCPA.

Update the System

Open a terminal and run the following command to update the system:

sudo dnf update -y

Install Required Dependencies

Next, install the necessary packages for compiling and running Nagios NCPA:

sudo dnf install -y gcc make git zlib-devel openssl-devel python3 python3-pip

Step 2: Download Nagios NCPA

Nagios provides a precompiled version of NCPA for various Linux distributions, including Fedora. To download the latest stable release of NCPA, follow these steps:

Navigate to the NCPA Downloads Page

Visit the NCPA Downloads Page to find the link to the latest version. Alternatively, you can use the wget command to fetch the .rpm package directly.

wget https://github.com/NagiosEnterprises/ncpa/releases/download/v2.3.0/ncpa-2.3.0-1.x86_64.rpm

Note: Ensure you replace the URL with the latest version number available on the website.

Step 3: Install Nagios NCPA

Once the .rpm package is downloaded, you can install it using the dnf package manager.

Install the NCPA Package

Run the following command to install NCPA:

sudo dnf install ./ncpa-2.3.0-1.x86_64.rpm

This will install the NCPA agent on your Fedora 39 workstation.

Step 4: Configure Nagios NCPA

After the installation is complete, you’ll need to configure NCPA to allow Nagios Core or any monitoring system to communicate with the agent. NCPA is controlled via a configuration file that allows you to define settings such as the API token, listening ports, and more.

Edit the NCPA Configuration File

The NCPA configuration file is located at /usr/local/ncpa/etc/ncpa.cfg. Open the configuration file in a text editor like nano or vi:

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

Inside the configuration file, you can customize the following:

  • API Token: NCPA uses an API token for authentication. By default, it will be set to a random value during installation. You can change it to something more secure and memorable. Find the line that starts with api_token and change its value:
api_token = your_secure_token_here
  • Listen Address and Port: By default, NCPA listens on 127.0.0.1:5693. You may want to configure it to listen on all network interfaces or a specific address. To allow access from any machine, change the bind_address value to 0.0.0.0:
bind_address = 0.0.0.0
  • Additional Configuration: You can configure other options like logging, plugins, and security settings as needed.

Once you’re done editing, save and close the file. Press CTRL + X, then Y to confirm your changes, and press Enter to save everything.

Enable and Start the NCPA Service

Now, you’ll need to enable and start the NCPA service to run it in the background:

sudo systemctl enable ncpa
sudo systemctl start ncpa

Check the status of the service to ensure that it’s running correctly:

sudo systemctl status ncpa

You should see output indicating that the NCPA service is active and running. If your screen looks similar to the one below then you can skip Step 5. If not continue to Step 5.

Fedora 41 Firewall
Fedora Firewall

Step 5: Configure Firewall (if applicable)

If your Fedora 39 workstation has a firewall enabled, you may need to allow traffic on the port that NCPA is using (default is 5693).

To allow NCPA traffic through the firewall, run:

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

This will open port 5693 for TCP traffic.

Step 6: Verify NCPA Installation

At this point, NCPA should be installed and running on your Fedora 39 workstation. To verify the installation, you can try to access the NCPA web interface.

Open a web browser and navigate to:

http://<your_fedora_ip>:5693

You should see the NCPA web interface login page. Use the api_token you set in the configuration file to log in. You can also use the NCPA command-line interface (CLI) to query the agent’s status or get system metrics. To test the API locally, you can use the following curl command:

curl -k -u api_token:your_secure_token_here http://127.0.0.1:5693/api/v1/status

This should return a JSON object with the current status of NCPA.

Step 7: Configure NCPA on Nagios XI

1. Log in to Nagios XI.

2. Open the NCPA Wizard by selecting Configure > Run a Monitoring Wizard > NCPA. In the search bar type NCPA to find it easily.

ConfigurationWizard NCPA
NCPA Wizard

3. Enter the IP address, API token, and system you are using (select Generic option).

NCPA Config Info Step1 Generic e1791385909933
NCPA Wizard Step 1

4. Complete the wizard setup by filling in the rest of the information in the remaining steps to your liking and click Finish, or click Finish w/Defaults.

5. After completing the Wizard, Nagios XI should display the monitored host and its services.

6. Navigate to the Host Status Detail page to confirm that the system is being monitored.

NCPA Fedora 41 Host Detail
NCPA Fedora – Host Detail

Refer to the Nagios documentation for instructions on how to add NCPA checks in Nagios Core.

Conclusion

You have successfully installed and configured NCPA on your Fedora 39 workstation. Now you can monitor your system’s metrics like CPU usage, memory, disk space, and more, either locally or remotely using Nagios Core or any other compatible monitoring tool.

NCPA simplifies the monitoring process and integrates well with both open-source and enterprise Nagios systems. You can further customize and fine-tune the NCPA configuration according to your specific needs.

For additional customization and advanced features, refer to the official NCPA documentation.

Additional Resources

Visit Our Website

Visit Nagios Support Forum

Visit Nagios Exchange

Visit Nagios Documentation Hub

Share: