How to Install Nagios Cross-Platform Agent (NCPA) on macOS

Picture of Jack Brisben
Jack Brisben

Nagios Cross-Platform Agent (NCPA) is a flexible and modern monitoring agent designed for Nagios Core and Nagios XI. It enables administrators to monitor system metrics, processes, services, and custom plugins with ease.

In this guide, we’ll walk through the steps to install and configure NCPA on macOS. Please note that a Nagios Core or Nagios XI server is required to receive monitoring data.

Prerequisites

Before proceeding with the installation, ensure that you meet the following requirements:

  • A macOS system (macOS 10.13 or later).
  • Administrator privileges to perform installation and configuration.
  • An active Nagios Core or Nagios XI server to receive monitoring data.

Step 1: Install Homebrew (if not already installed)

Homebrew is a popular package manager for macOS. If you don’t already have it installed, you can install it by running the following command:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Step 2: Download and Install the NCPA Package

As of now, Nagios doesn’t provide a direct macOS package for NCPA. However, you can use Homebrew to install it via the ncpa formula.

To install the NCPA package on macOS, run the following commands:

  1. Update Homebrew (if needed):
brew update

2. Install NCPA:

brew install nagios/ncpa/ncpa

Step 3: Start and Enable the NCPA Agent

Once the installation is complete, you can start the NCPA listener and passive services:

sudo /usr/local/ncpa/ncpa_listener -start
sudo /usr/local/ncpa/ncpa_passive -start

To ensure the services start automatically on boot, you can use the launchctl tool to manage the services:

  1. Enable NCPA services to start on boot:
sudo launchctl load /Library/LaunchDaemons/com.nagios.ncpa_listener.plist
sudo launchctl load /Library/LaunchDaemons/com.nagios.ncpa_passive.plist

2. Start the services immediately:

sudo launchctl start com.nagios.ncpa_listener
sudo launchctl start com.nagios.ncpa_passive
  1. Check the status of the services:bashCopysudo launchctl list | grep ncpa

Step 4: Configure NCPA

4.1 Edit the NCPA Configuration File

The NCPA configuration file is located at /usr/local/ncpa/etc/ncpa.cfg. To modify it:

  1. Open the configuration file in your preferred text editor
sudo nano /usr/local/ncpa/etc/ncpa.cfg

2. Modify the following settings:

  • API Token: This is required for secure communication with Nagios. Update the community_string field to something memorable:
community_string = Str0ngT0k3n!
  • Allowed IPs: Restrict access to trusted Nagios servers by adding their IP addresses:
allowed_hosts = <Nagios IP address>

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

4.2 Restart NCPA Services

After modifying the configuration file, restart the NCPA services for the changes to take effect:

sudo /usr/local/ncpa/ncpa_listener -restart
sudo /usr/local/ncpa/ncpa_passive -restart

Step 5: Verify NCPA Installation

5.1 Check the NCPA Web Interface

By default, NCPA runs on port 5693. You can access the web interface by opening a web browser and navigating to:

https://<your_mac_system>:5693

Log in using the API token you configured earlier.

5.2 Test NCPA with Nagios

To verify that your Nagios server can communicate with the NCPA agent, run the following command from your Nagios monitoring server:

curl -k https://<your_mac_system>:5693/api

You should receive a JSON response indicating the system’s status.

Step 6: Add NCPA to Nagios

On your Nagios XI web GUI:

  • Navigate to Run a Wizard.
  • Select Mac OS X.
Screenshot 2025 02 20 093742
How to Install Nagios Cross-Platform Agent (NCPA) on macOS 3
  • Enter the IP address of your macOS system and the token you created in the configuration file.
  • Click Next and choose the system metrics you want to monitor, or leave everything as default. Hit Finish to complete the setup.
Screenshot 2025 02 20 094438
How to Install Nagios Cross-Platform Agent (NCPA) on macOS 4

By following these steps, you have successfully installed Nagios Cross-Platform Agent (NCPA) on macOS. Your Nagios monitoring server will now be able to collect system metrics and monitor your macOS system in real-time.

Additional Resources

Need Help?

For further assistance, visit our support page or contact our team.

Share:

Table of Contents