Issues installing Nagios OS X Agent on OS X 10.10.6

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
NobodyNew
Posts: 7
Joined: Sat Sep 24, 2016 10:07 pm

Re: Issues installing Nagios OS X Agent on OS X 10.10.6

Post by NobodyNew »

Well this is just getting silly now...

I went ahead and used Homebrew as that seems like the only way out of this for now...

So about half of the default services the OS X wizzard adds are still broken, namely:

Code: Select all

/ Disk Usage     :::   DISK CRITICAL - 20% is not accessible: No such file or directory
CPU Stats	        :::   NRPE: Command 'check_cpu_stats' not defined
Memory Usage	:::   NRPE: Command 'check_mem' not defined
More were broken but I edited the file /usr/local/nagios/etc/nrpe.cfg and got check_procs working and check_disk at least returning a response, although it looks like the arguments sent to it are incorrect...
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Issues installing Nagios OS X Agent on OS X 10.10.6

Post by lmiltchev »

The "fullinstall" script runs all of the required scripts in sub-directories. As it failed, some of the scripts probably didn't run...

The commands that are "not defined" *should* be defined in the "/usr/local/nagios/etc/nrpe/common.cfg" file. It's in the "/macosx/subcomponents/nrpe/mods/cfg/nrpe". The "post-install" script in the "nrpe" folder should have taken care of that.

See the script below:

Code: Select all

#!/bin/sh

echo "NRPE-POST"

# Post-install modifications

# Cfg subdirectory
mkdir /usr/local/nagios/etc/nrpe

# Config files/dirs
cp -r mods/cfg/* /usr/local/nagios/etc

# Permissions
chown -R $user:$group /usr/local/nagios/etc/nrpe.cfg /usr/local/nagios/etc/nrpe/


cp -f org.nagios.nrpe.plist /Library/LaunchDaemons/org.nagios.nrpe.plist

echo "org.nagios.nrpe setup to start on boot"
The commands that are defined in the "common.cfg" are the ones that are used by the "Mac OS X" monitoring wizard.
Be sure to check out our Knowledgebase for helpful articles and solutions!
NobodyNew
Posts: 7
Joined: Sat Sep 24, 2016 10:07 pm

Re: Issues installing Nagios OS X Agent on OS X 10.10.6

Post by NobodyNew »

lmiltchev wrote:The "fullinstall" script runs all of the required scripts in sub-directories. As it failed, some of the scripts probably didn't run...

The commands that are "not defined" *should* be defined in the "/usr/local/nagios/etc/nrpe/common.cfg" file. It's in the "/macosx/subcomponents/nrpe/mods/cfg/nrpe". The "post-install" script in the "nrpe" folder should have taken care of that.

See the script below:

Code: Select all

#!/bin/sh

echo "NRPE-POST"

# Post-install modifications

# Cfg subdirectory
mkdir /usr/local/nagios/etc/nrpe

# Config files/dirs
cp -r mods/cfg/* /usr/local/nagios/etc

# Permissions
chown -R $user:$group /usr/local/nagios/etc/nrpe.cfg /usr/local/nagios/etc/nrpe/


cp -f org.nagios.nrpe.plist /Library/LaunchDaemons/org.nagios.nrpe.plist

echo "org.nagios.nrpe setup to start on boot"
The commands that are defined in the "common.cfg" are the ones that are used by the "Mac OS X" monitoring wizard.
I don't understand what you are saying the resolution for this is.
There is no /usr/local/nagios/etc/nrpe/ directory, nor is there a /macosx/subcomponents/nrpe/mods/cfg/nrpe/ directory.
There is a /usr/local/nagios/etc/nrpe.cfg file.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Issues installing Nagios OS X Agent on OS X 10.10.6

Post by lmiltchev »

I am sorry, I didn't make myself clear - these files can be found in the "original" install directory (and sub-directories), usually "/tmp/". See below:

Code: Select all

sh-3.2# pwd
/tmp/macosx/subcomponents/nrpe

sh-3.2# ls -la
total 848
drwxr-xr-x  7 root  wheel     238 Jul 17  2014 .
drwxr-xr-x  6 root  wheel     204 Jul 17  2014 ..
-rwxr-xr-x  1 root  wheel     462 Jul 11  2014 install
drwxr-xr-x  3 root  wheel     102 Jul 17  2014 mods
-rw-r--r--  1 root  wheel  419695 Jul 11  2014 nrpe-2.15.tar.gz
-rw-r--r--  1 root  wheel     637 Jul 11  2014 org.nagios.nrpe.plist
-rwxr-xr-x  1 root  wheel     390 Jul 17  2014 post-install

sh-3.2# ls -laR mods
total 0
drwxr-xr-x  3 root  wheel  102 Jul 17  2014 .
drwxr-xr-x  7 root  wheel  238 Jul 17  2014 ..
drwxr-xr-x  4 root  wheel  136 Jul 17  2014 cfg

mods/cfg:
total 16
drwxr-xr-x  4 root  wheel   136 Jul 17  2014 .
drwxr-xr-x  3 root  wheel   102 Jul 17  2014 ..
drwxr-xr-x  4 root  wheel   136 Jul 17  2014 nrpe
-rw-r--r--  1 root  wheel  7217 Apr 16  2012 nrpe.cfg

mods/cfg/nrpe:
total 16
drwxr-xr-x  4 root  wheel   136 Jul 17  2014 .
drwxr-xr-x  4 root  wheel   136 Jul 17  2014 ..
-rw-r--r--  1 root  wheel   687 Apr 16  2012 asterisk.cfg
-rw-r--r--  1 root  wheel  1246 Sep 25  2012 common.cfg

sh-3.2# cat post-install
#!/bin/sh

echo "NRPE-POST"

# Post-install modifications

# Cfg subdirectory
mkdir /usr/local/nagios/etc/nrpe

# Config files/dirs
cp -r mods/cfg/* /usr/local/nagios/etc

# Permissions
chown -R $user:$group /usr/local/nagios/etc/nrpe.cfg /usr/local/nagios/etc/nrpe/


cp -f org.nagios.nrpe.plist /Library/LaunchDaemons/org.nagios.nrpe.plist

echo "org.nagios.nrpe setup to start on boot"

sh-3.2# cat mods/cfg/nrpe/common.cfg

### GENERIC SERVICES ###
command[check_init_service]=/usr/local/nagios/libexec/check_init_service_osx $ARG1$
command[check_services]=/usr/local/nagios/libexec/check_services -p $ARG1$

### MISC SYSTEM METRICS ###
#command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_users]=/usr/local/nagios/libexec/check_users $ARG1$
command[check_load]=/usr/local/nagios/libexec/check_load $ARG1$
command[check_swap]=/usr/local/nagios/libexec/check_swap $ARG1$
command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats.sh $ARG1$
command[check_mem]=/usr/local/nagios/libexec/check_osx_mem.sh $ARG1$

### YUM UPDATES ###
command[check_yum]=/usr/local/nagios/libexec/check_yum

### DISK ###
command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$
command[check_ide_smart]=/usr/local/nagios/libexec/check_ide_smart $ARG1$

### PROCESSES ###
command[check_all_procs]=/usr/local/nagios/libexec/custom_check_procs
command[check_procs]=/usr/local/nagios/libexec/check_procs $ARG1$

### OPEN FILES ###
command[check_open_files]=/usr/local/nagios/libexec/check_open_files.pl $ARG1$

### NETWORK CONNECTIONS ###
command[check_netstat]=/usr/local/nagios/libexec/check_netstat.pl -p $ARG1$ $ARG2$
If you haven't run the "post-install" script yet, you could try:

Code: Select all

cd /tmp/macosx/subcomponents/nrpe
./post-install
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Issues installing Nagios OS X Agent on OS X 10.10.6

Post by Box293 »

NobodyNew wrote:I don't understand what you are saying the resolution for this is.
There is no /usr/local/nagios/etc/nrpe/ directory, nor is there a /macosx/subcomponents/nrpe/mods/cfg/nrpe/ directory.
There is a /usr/local/nagios/etc/nrpe.cfg file.
There may some confusion that I'll clear up.

The version of NRPE that you originally had trouble with (macosx-nrpe-agent) automates the install of NRPE, the plugins, adds extra plugins and is specifically for people using Nagios XI as it works well with the wizard.

As we already identified it's broken (and a bug report has been filed to fix it).

So to get you a working NRPE build I gave you the NRPE v3 install guide which works on OS X. However this is just the "vanilla basics" and does not have all the specific stuff the macosx-nrpe-agent does. NRPE v3 was only recently released so we haven't had a chance to update our macosx-nrpe-agent to v3 yet.

We can however help you get it working the same.

If you extracted macosx-nrpe-agent to /tmp/macosx-nrpe-agent/
Create the dirtectory /usr/local/nagios/etc/nrpe/
Copy /tmp/macosx-nrpe-agent/subcomponents/nrpe/mods/cfg/common.cfg to /usr/local/nagios/etc/nrpe/
Edit the file /usr/local/nagios/etc/nrpe.cfg
Add the line:
include_dir=/usr/local/nagios/etc/nrpe
Save

If you followed the guide and installed the Nagios Plugins that are available via Homebrew, these get installed to /usr/local/sbin/ so the config file also needs to be updated.

Code: Select all

sudo sed -i '' 's/nagios\/libexec/sbin/' /usr/local/nagios/etc/nrpe/common.cfg
Restart NRPE:

Code: Select all

sudo launchctl stop org.nagios.nrpe
sudo launchctl start org.nagios.nrpe
Any missing plugins will be located in:
/tmp/macosx-nrpe-agent/subcomponents/extraplugins/plugins and you can copy them to /usr/local/sbin/
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked