Problems installing/testing Nagios on OSX Sierra

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Aelonia
Posts: 12
Joined: Wed Aug 23, 2017 3:43 pm

Problems installing/testing Nagios on OSX Sierra

Post by Aelonia »

I'm a graduate student who's looking into tools for getting measures of a database, and I've been trying to install and try out Nagios. As an initial test, I'm just trying to get it running locally on my Macbook Pro (OSX 10.12.5), monitoring a local database. I have been following the instructions here: https://support.nagios.com/kb/article/n ... Apple_OS_X It's generally gone smoothly, but I don't have a lot of experience in this area and have run into a few roadblocks. Hopefully these questions are appropriate for this forum and not too basic - I'd appreciate any help I could get!

After I install Nagios and the requisite plugins, I can go to localhost/nagios to see the web interface. The tutorial then says "Go to a host or service object and "Re-schedule the next check" under the Commands menu". I don't see a 'Commands' menu, though are links under 'Current status' to 'Hosts' and 'Services'. When I click on them, however, they download .cgi files rather than actually loading a list of hosts/services. Is there another way to check these, or do I not have something configured right?
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Problems installing/testing Nagios on OSX Sierra

Post by cdienger »

Sounds like the cgi module didn't load. Do you have a 01-cgi.conf under /etc/httpd/conf.modules.d ? It should look something like:

Code: Select all

<IfModule mpm_worker_module>
   LoadModule cgid_module modules/mod_cgid.so
</IfModule>
<IfModule mpm_event_module>
   LoadModule cgid_module modules/mod_cgid.so
</IfModule>
<IfModule mpm_prefork_module>
   LoadModule cgi_module modules/mod_cgi.so
</IfModule>
Once you have that you should be able to drill down to find your hosts and services. There you'll find the commands menu.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Aelonia
Posts: 12
Joined: Wed Aug 23, 2017 3:43 pm

Re: Problems installing/testing Nagios on OSX Sierra

Post by Aelonia »

I don't seem to have that directory. In fact, I can't find many .conf files on my computer at all. The tutorial had me editing /opt/local/apache2/conf/httpd.conf and then installing Nagios plugins in /opt/local/libexec/nagios/. Is there some step I missed that could have installed the cgi module?
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Problems installing/testing Nagios on OSX Sierra

Post by cdienger »

I was looking at a different install : ) What do you see in /opt/local/apache2/modules/ and /opt/local/apache2/conf/httpd.conf ? Can you attach a copy of the httpd.conf ?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Aelonia
Posts: 12
Joined: Wed Aug 23, 2017 3:43 pm

Re: Problems installing/testing Nagios on OSX Sierra

Post by Aelonia »

In /opt/local/apache2/modules/, I have:

Code: Select all

httpd.exe
mod_authz_dbm.so
mod_dbd.so
mod_imagemap.so
mod_proxy_ajp.so
mod_substitute.so
mod_actions.so
mod_authz_default.so
mod_deflate.so
mod_include.so
mod_proxy_balancer.so
mod_unique_id.so
mod_alias.so
mod_authz_groupfile.so
mod_dir.so
mod_info.so
mod_proxy_connect.so
mod_userdir.so
mod_asis.so
mod_authz_host.so
mod_disk_cache.so
mod_log_config.so
mod_proxy_ftp.somod_usertrack.so
mod_auth_basic.so
mod_authz_owner.so
mod_dumpio.so
mod_log_forensic.so
mod_proxy_http.so
mod_version.so
mod_auth_digest.so
mod_authz_user.so
mod_env.so
mod_logio.so
mod_proxy_scgi.so
mod_vhost_alias.so
mod_authn_alias.so
mod_autoindex.so
mod_expires.so	
mod_mem_cache.so
mod_reqtimeout.so
nagioscore.tar.gz
mod_authn_anon.so
mod_cache.so
mod_ext_filter.so
mod_mime.so
mod_rewrite.so
mod_authn_dbd.so
mod_cern_meta.so
mod_file_cache.so
mod_mime_magic.so
mod_setenvif.so
mod_authn_dbm.so
mod_cgi.so
mod_filter.so
mod_negotiation.so
mod_speling.so
mod_authn_default.so
mod_dav.so
mod_headers.so
mod_php70.so
mod_ssl.so
mod_authn_file.so
mod_dav_fs.so
mod_ident.so
mod_proxy.so
mod_status.so
and /opt/local/apache2/conf/httpd.conf is attached.
Attachments
httpd.conf
/opt/local/apache2/conf/httpd.conf
(17.34 KiB) Downloaded 343 times
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Problems installing/testing Nagios on OSX Sierra

Post by cdienger »

Do you see cgI_module loaded if you run:

Code: Select all

apachectl -M | grep cgi
Also, what are the permissions of the /usr/local/nagios/sbin/* directory:

Code: Select all

ll /usr/local/nagios/sbin/
? The execute bit should be set for everybody.

If you have a /opt/local/apache2/conf.d/nagios.conf, please provide that as well.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Aelonia
Posts: 12
Joined: Wed Aug 23, 2017 3:43 pm

Re: Problems installing/testing Nagios on OSX Sierra

Post by Aelonia »

When I run

Code: Select all

apachectl -M | grep cgi
I get the error:

Code: Select all

httpd: Syntax error on line 611 of /private/etc/apache2/httpd.conf: Could not open configuration file /conf/extra/nagios.conf: No such file or directory
The tutorial had me add

Code: Select all

Include conf/extra/nagios.conf
Include conf/extra/mod_php70.conf
to httpd.conf, which seems to be the issue. If I change those to use the full path of /opt/local/apache2/conf/extra/, I no longer get that error. However, instead, I get:

Code: Select all

[Tue Aug 29 19:23:00.437108 2017] [alias:warn] [pid 83589] AH00671: The ScriptAlias directive in /private/etc/apache2/httpd.conf at line 549 will probably never match because it overlaps an earlier ScriptAlias.
[Tue Aug 29 19:23:00.437378 2017] [alias:warn] [pid 83589] AH00671: The Alias directive in /private/etc/apache2/httpd.conf at line 580 will probably never match because it overlaps an earlier Alias.
[Tue Aug 29 19:23:00.437387 2017] [alias:warn] [pid 83589] AH00671: The ScriptAlias directive in /opt/local/apache2/conf/extra/nagios.conf at line 8 will probably never match because it overlaps an earlier ScriptAlias.
[Tue Aug 29 19:23:00.437395 2017] [alias:warn] [pid 83589] AH00671: The Alias directive in /opt/local/apache2/conf/extra/nagios.conf at line 39 will probably never match because it overlaps an earlier Alias.
So, getting the impression my files are pretty messed up. :?


Edit:
I'm definitely not seeing the cgi module there, though.

Permissions for /usr/local/nagios/sbin/* are -rwxr-xr-x, so that should be fine.

I do not have a /opt/local/apache2/conf.d directory (only ....../conf). The only nagios.conf files I have are:

Code: Select all

/opt/local/apache2/conf/extra/nagios.conf
/private/etc/apache2/other/nagios.conf
/usr/local/Cellar/nagios/4.3.3/share/nagios.conf
/usr/local/share/nagios.conf
(with the second pointing to the third)
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Problems installing/testing Nagios on OSX Sierra

Post by cdienger »

Yeah, something's not quite right. What happens if you comment out those lines that it's complaining about? Can you start fresh?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Aelonia
Posts: 12
Joined: Wed Aug 23, 2017 3:43 pm

Re: Problems installing/testing Nagios on OSX Sierra

Post by Aelonia »

If I comment out the lines it complained about, then it starts complaining about lines in /opt/local/apache2/conf/extra/nagios.conf. If I comment out the lines in that one, then I get:

Code: Select all

AH00557: httpd: apr_sockaddr_info_get() failed for mcnulty
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
Starting fresh sounds like the great idea, but I'm not sure what the best way is to fully clean up everything. I tried a few different nagios tutorials after the first one didn't work, so that's possibly what's complicating things, but I'm not sure how best to remove it all - just delete every nagios/apache-related file?
Aelonia
Posts: 12
Joined: Wed Aug 23, 2017 3:43 pm

Re: Problems installing/testing Nagios on OSX Sierra

Post by Aelonia »

I noticed there was an update to 4.3.4 since I last tried to install, so I tried running through the instructions with the new version and am now getting stopped when trying to start nagios. Upon running sudo /etc/rc.d/init.d/nagios start, I get:

Code: Select all

-n Starting nagios:
ERROR: Could not create or update '/usr/local/nagios/var/nagios.configtest'
There is no /usr/local/nagios/var/nagios.configtest, and /usr/local/nagios/var/ has permissions so that shouldn't be an issue.
Locked