NagiosEnterprises / ncpa

Nagios Cross-Platform Agent
Other
176 stars 95 forks source link

NCPA 3.0.1 failing to start on macOS 14 (no /usr/local/Cellar directory exists) #1112

Closed xyzzy-plugh closed 3 months ago

xyzzy-plugh commented 4 months ago

Fairly recent OS install, largely vanilla. Suggestions on what to do welcome!

Hardware: macMini 2023, Apple M2 CPU OS: Sonoma 14.3.1

I downloaded NCPA 3.0.1 DMG, mounted it and installed ... which seemed to work OK:

% sudo zsh /Volumes/NCPA-3.0.1/install.sh 
Starting install... 
    MacOS version: 14.3.1.
    Adding nagios user and group... Creating the group account... Creating the user account... Done.
    Removing MacOS xattributes from LaunchDaemon plists... Done.
    Copying new NCPA files... Done.
    Setting permissions... Done.
    Removing MacOS xattributes from /usr/local/ncpa... Done.
    Starting NCPA... Done.
---------------------------------------
Listing NCPA components... 

LaunchDaemons?:
81674   0   com.nagios.ncpa

LaunchDaemon plists?:
-rw-r--r--   1 root  wheel   608 Feb 26 12:54 com.nagios.ncpa.plist

dscl group?:
_nagios nagios
nagios

dscl user?:
nagios

Home dir?:
drwxrwxr-x  13 nagios  nagios  416 Feb 26 12:54 ncpa

Processes?:
root             81674   0.0  0.0 33588608     12   ??  Ss   12:54PM   0:00.01 /usr/local/ncpa/ncpa -n

-------------------
 Install Completed 
-------------------

Confirm your installation:
    1. In a web browser, navigate to https://localhost:5693 
       (acknowledge the uncertified certificate warning, if necessary)
    2. Enter 'mytoken' when it asks for a token or a password
    3. Click the 'See Live Stats' button

    After several seconds the graphs should start populating with data.
    NCPA is now capturing data from your Mac!
%

Immediately after installing (as-installed, default ncpa.cfg file) - however, it's not running...

% sudo launchctl list com.nagios.ncpa
{
    "LimitLoadToSessionType" = "System";
    "Label" = "com.nagios.ncpa";
    "OnDemand" = true;
    "LastExitStatus" = 65280;
    "Program" = "/usr/local/ncpa/ncpa";
    "ProgramArguments" = (
        "/usr/local/ncpa/ncpa";
        "-n";
    );
};

Trying to start it from the command line yields the following. Note, no /usr/local/Cellar directory exists on this system.

% /usr/local/ncpa/ncpa              
Traceback (most recent call last):
  File "__startup__.py", line 124, in run
  File "console.py", line 16, in run
  File "ncpa.py", line 22, in <module>
  File "gevent/monkey.py", line 1235, in patch_all
  File "gevent/monkey.py", line 187, in ignores
  File "gevent/monkey.py", line 999, in patch_ssl
  File "gevent/monkey.py", line 448, in _patch_module
  File "gevent/monkey.py", line 434, in _check_availability
  File "gevent/ssl.py", line 11, in <module>
  File "ssl.py", line 100, in <module>
ImportError: dlopen(/usr/local/ncpa/lib/_ssl.cpython-311-darwin.so, 0x0002): Library not loaded: /usr/local/Cellar/openssl@3/3.2.0_1/lib/libcrypto.3.dylib
  Referenced from: <EA4D03AF-497E-35D7-84E9-DBC4F758A425> /usr/local/ncpa/lib/libssl.3.dylib
  Reason: tried: '/usr/local/Cellar/openssl@3/3.2.0_1/lib/libcrypto.3.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/Cellar/openssl@3/3.2.0_1/lib/libcrypto.3.dylib' (no such file), '/usr/local/Cellar/openssl@3/3.2.0_1/lib/libcrypto.3.dylib' (no such file), '/usr/local/lib/libcrypto.3.dylib' (no such file), '/usr/lib/libcrypto.3.dylib' (no such file, not in dyld cache)

No logfile entries:

 % ls -al /usr/local/ncpa/var/log 
total 0
drwxrwxr-x  4 nagios  nagios  128 Feb 26 12:54 .
drwxrwxr-x  3 nagios  nagios   96 Feb 26 12:54 ..
-rwxrwxr-x  1 nagios  nagios    0 Feb 26 12:54 ncpa_listener.log
-rwxrwxr-x  1 nagios  nagios    0 Feb 26 12:54 ncpa_passive.log
ne-bbahn commented 4 months ago

Installing NCPA:

  1. Download MacOS archive (https://www.nagios.org/ncpa/#downloads)

  2. Double click open the disk image file to mount it

  3. Find the installer volume name in the terminal: ls /Volumes Look for NCPA- (e.g. NCPA-3.0.0)

  4. Run the installer, and follow any user prompts: sudo zsh /Volumes/NCPA-/install.sh

Note: if you already have NCPA installed, the installer will upgrade the NCPA software, and retain your configuration.

Restarting NCPA: After making configuration changes, you will need to restart NCPA for changes to take effect. This is accomplished by stopping then starting the service.

1. On the command line, enter:
     sudo launchctl stop com.nagios.ncpa
     sudo launchctl start com.nagios.ncpa

It looks like you tried to run NCPA directly. Have you tried running it with sudo launchctl start com.nagios.ncpa? I believe this is the intended method of starting NCPA on Mac and it worked when I tested it on Mac OS 13 and 14 before with NCPA 3.

xyzzy-plugh commented 4 months ago

Thanks …

yes, I did try this … many times stopping & starting via launchctl. (FYI I’ve also successfully used NCPA with many Linux & Windows hosts, and a couple of older Mac hosts. Have some new Mac boxes I want to monitor now, wanted to try NCPA v3 because of a few things)

First I established nothing was running listening on port 5693…so no sense trying to troubleshoot from the Nagios server side.

The manual start of NCPA was purely so I could see the traces and why it was not starting.

Happy to try anything else to capture more info if needed.

xyzzy-plugh commented 3 months ago

Thanks!

I can confirm that 3.0.2 works correctly on macOS 14.4.1 (M2 CPU)