NCPA (Nagios Cross-Platform Agent)

repository·master·Indexed 42 days ago

https://github.com/nagiosenterprises/ncpa

A unified monitoring agent for Linux, Windows, macOS, and Solaris that enables active and passive Nagios monitoring. Features include a token-based API for metrics, WebSocket endpoints for real-time system stats and log tailing, and a Web GUI for configuration management. Supports NRDP proxying and dynamic passive check management.

Tokens
4.2K
Snippets
17
Records
24
Agent score
53%

What's inside NCPA

  1. Overview of Nagios Cross-Platform Agent (NCPA)

    master

    NCPA is a single monitoring agent designed to install on all major operating systems. It supports both active checks (using check_ncpa.py) and passive checks (via NRDP).

    Key features include:

    • Built-in web GUI
    • Built-in documentation
    • Websocket graphing
    • Default SSL security
  2. Uninstall NCPA on Solaris

    master

    To remove NCPA, use the standard package removal command:

    pkgrm ncpa

    Troubleshooting Uninstall Issues

    If pkgrm hangs or the package still appears in pkginfo:

    1. Kill hanging processes: sudo pkill -f pkgrm
    2. Force removal (advanced): sudo pkgrm -a /dev/null ncpa
    3. Manual Database Cleanup: If the package persists in the database, you may need to manually remove the directory /var/sadm/pkg/ncpa and run sudo pkgchk -n.
    4. Manual File Cleanup: If a complete manual wipe is required, remove:
      • SMF services: svcadm disable application/ncpa
      • Startup links: /etc/rc*.d/S99ncpa
      • Service scripts: /usr/local/bin/ncpa-service, /etc/init.d/ncpa
      • Installation directory: /usr/local/ncpa
  3. Build and install NCPA on Solaris

    master

    NCPA can be built on Solaris 11.4 SRU78 or higher. The build process creates a native Solaris package (.pkg) using a Python virtual environment and cx_Freeze.

    Build Steps

    1. Clone the repository:
      cd ~
      git clone https://github.com/NagiosEnterprises/ncpa
    2. Run the build script:
      cd ncpa/build
      sudo ./build.sh

    Installation

    Copy the resulting .pkg file (architecture specific: .sparc.pkg or .i386.pkg) to the target server and install:

    pkgadd -d ./ncpa-3.X.X.<arch>.pkg

    Silent Installation

    For automated installs, use an admin_file. Sample admin files are located in /usr/local/ncpa/ or /ncpa/build/solaris/ in the repository:

    pkgadd -a ./admin_file -d ./ncpa-3.X.X.<arch>.pkg ncpa
    cd ncpa/build
    sudo ./build.sh
  4. Build NCPA from source

    master

    While pre-built binaries are recommended, you can build NCPA from source. This typically requires installing the newest version of Python 2.7 and several modules via pip.

    Specific instructions for different platforms are available in the building documentation for:

    • Windows
    • Linux
    • macOS
    • Solaris
    • AIX
  5. Manage NCPA services on Solaris

    master

    NCPA on Solaris provides two methods for service management: a dedicated service script and SMF (Service Management Facility) integration.

    Primary Method: Service Script

    Use the /usr/local/bin/ncpa-service script for standard operations:

    • start, stop, restart, status, killall

    Secondary Method: SMF

    If the service is visible in SMF, use svcadm:

    • Enable: svcadm enable application/ncpa
    • Disable: svcadm disable application/ncpa
    • Check status: svcs application/ncpa

    Troubleshooting Commands

    • Aggressive cleanup of stuck processes: sudo /usr/local/bin/ncpa-service killall
    • Check service status: sudo /usr/local/bin/ncpa-service status
    • View running processes: ps -ef | grep ncpa
    • Check logs: tail -f /usr/local/ncpa/var/log/ncpa.log
    /usr/local/bin/ncpa-service {start|stop|restart|status|killall}
  6. Build NCPA on Linux

    master

    NCPA should be built on the same distribution family it will run on (e.g., build on Ubuntu to target Debian/Ubuntu).

    Prerequisites

    • Python: Requires python3.11+ (Python 3.13 is preferred). If not available in your repositories, you must build Python from source and ensure the binary is in your PATH.
    • Git: Required to clone the repository.
    • RHEL/Oracle/CentOS/Amazon/Rocky: You must enable the CodeReady Builder (CRB) and EPEL repositories to access required development packages.

    Build Steps

    1. Clone the repository.
    2. Run the build script as root.

    Troubleshooting: If the build fails after a dependency update (like Python or OpenSSL), delete the prereqs.installed file and try again.

    cd ~
    git clone https://github.com/NagiosEnterprises/ncpa
    
    cd ncpa/build
    ./build.sh
  7. Build NCPA on Windows

    master

    To build the NCPA installer on Windows, use a machine without Python installed. The build process uses cmd.exe and requires Administrative privileges. The script uses Chocolatey to install necessary prerequisites.

    Note: You may be required to reboot your machine several times during the process. If a reboot is pending, restart the machine and rerun the script.

    Upon successful completion, an ncpa-<version>.exe installer will be created in the build directory.

    cd /path/to/ncpa/build/
    build_windows.bat
  8. Install the NCPA package on Linux

    master

    After building, copy the resulting .rpm or .deb package to your target server and install it using the command corresponding to your distribution:

    • CentOS/RHEL/Oracle/Amazon/Rocky: Use yum.
    • Ubuntu 18+/Debian 10+: Use dpkg.
    • Ubuntu 14-16/Debian 8-9: Use dpkg with --force-depends (unsupported but may work).
    • OpenSuSE/SLES: Use zypper.
    # CentOS/RHEL/Oracle/Amazon/Rocky
    yum install ./ncpa-3.X.X-latest.x86_64.rpm
    
    # Ubuntu 18+/Debian 10+
    dpkg -i ./ncpa_3.X.X-latest._amd64.deb
    
    # Ubuntu 14-16/Debian 8-9 (unsupported)
    dpkg --force-depends -i ./ncpa_3.X.X-latest._amd64.deb
    
    # OpenSuSE/SLES
    zypper install ./ncpa-3.X.X-latest.x86_64.rpm
  9. Update GPG keys for Nagios repositories

    master

    If your Nagios repository is outdated, you must update your GPG key before installing NCPA. Use the commands corresponding to your operating system distribution.

    ### CentOS/RHEL/Oracle
    ```bash
    yum clean all
    rpm --import https://repo.nagios.com/GPG-KEY-NAGIOS-V3

    Ubuntu/Debian

    wget -qO - https://repo.nagios.com/GPG-KEY-NAGIOS-V3 | apt-key add -
  10. Configure NCPA using multiple configuration files

    master

    In addition to the main ncpa.cfg file, you can provide additional configuration settings by placing files with a .cfg extension in the /etc/ncpa.cfg.d/ directory.

    NCPA parses and merges these files with the primary ncpa.cfg file. The files are processed in alphabetical order based on their filename. This allows you to modularize your configuration or manage settings for different components separately.

  11. Build and install NCPA on AIX

    master

    NCPA can be built on AIX 7.3 TL4 or higher. The build process creates a .ppc.rpm package for use with dnf.

    Prerequisites

    • dnf (AIX package manager)
    • python3.12 (from IBM AIX Toolbox)
    • git

    Build Steps

    1. Clone the repository:
      cd ~
      git clone https://github.com/NagiosEnterprises/ncpa
    2. Run the build script as root:
      cd ~/ncpa/build
      ./build.sh

    Installation

    Install the resulting .rpm using dnf:

    dnf localinstall ncpa-3.X.X-latest.ppc.rpm

    Note: Upgrades from NCPA 2.x to 3.x are not supported on AIX. You must uninstall version 2.x before installing 3.x.

    Service Management

    NCPA uses the AIX SRC service manager:

    • Start: startsrc -s ncpa
    • Stop: stopsrc -s ncpa
    • Status: lssrc -s ncpa
    cd ~/ncpa/build
    ./build.sh
  12. Build NCPA on MacOS

    master

    Building on MacOS requires python3.13, homebrew, and git.

    Build Steps

    1. Install Xcode Command Line Tools.
    2. Clone the repository.
    3. Install Homebrew.
    4. Install Python 3.13 via Homebrew.
    5. Run the build script with sudo.

    Note: Installation on newer macOS versions may be complicated by enhanced system security and Apple Developer credential requirements.

    xcode-select --install
    
    cd ~
    git clone https://github.com/NagiosEnterprises/ncpa
    
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
    brew install python@3.13
    
    cd ~/ncpa/build
    sudo ./build.sh