Page 2 of 3

Re: Problems installing/testing Nagios on OSX Sierra

Posted: Fri Sep 01, 2017 9:52 am
by scottwilkerson
could you share the following:

Code: Select all

ls -al /usr/local/nagios/var/nagios.configtest
ls -al /usr/local/nagios/var
ls -al /usr/local/nagios

Re: Problems installing/testing Nagios on OSX Sierra

Posted: Fri Sep 01, 2017 1:17 pm
by Aelonia

Code: Select all

ls -al /usr/local/nagios/var/nagios.configtest
ls: /usr/local/nagios/var/nagios.configtest: No such file or directory



ls -al /usr/local/nagios/var
total 104
drwxrwxrwx  9 nagios  nagios    306 Aug 31 19:46 .
drwxr-xr-x  8 root    wheel     272 Aug 18 16:11 ..
drwxrwxr-x  8 nagios  nagios    272 Aug 31 00:00 archives
-rw-r--r--  1 nagios  nagios   4041 Aug 31 17:33 nagios.log
-rw-r--r--  1 nagios  nagios  12655 Aug 28 15:12 objects.cache
-rw-r--r--  1 nagios  nagios  12655 Aug 31 15:40 objects.precache
-rw-------  1 nagios  nagios  13369 Aug 31 17:33 retention.dat
drwxrwsr-x  2 nagios  nagios     68 Aug 31 17:33 rw
drwxr-xr-x  3 root    nagios    102 Aug 18 16:01 spool



ls -al /usr/local/nagios
total 0
drwxr-xr-x   8 root    wheel    272 Aug 18 16:11 .
drwxr-xr-x  29 root    wheel    986 Aug 18 16:01 ..
drwxrwxr-x   4 nagios  nagios   136 Aug 31 18:53 bin
drwxrwxr-x  10 nagios  nagios   340 Aug 31 19:00 etc
drwxrwxr-x   2 nagios  nagios    68 Aug 18 16:01 libexec
drwxrwxr-x  21 nagios  nagios   714 Aug 31 18:53 sbin
drwxrwxr-x  37 nagios  nagios  1258 Aug 31 18:53 share
drwxrwxrwx   9 nagios  nagios   306 Aug 31 19:46 var

Re: Problems installing/testing Nagios on OSX Sierra

Posted: Fri Sep 01, 2017 3:57 pm
by scottwilkerson
Based on what these show it should work, but just to make sure lets do the following

Code: Select all

touch /usr/local/nagios/var/nagios.configtest
chown nagios:nagios /usr/local/nagios/var/nagios.configtest
chmod ug+wx /usr/local/nagios/var/nagios.configtest
and then try again

Re: Problems installing/testing Nagios on OSX Sierra

Posted: Sun Sep 03, 2017 11:24 pm
by Aelonia
I can touch nagios.configtest just fine, which creates the blank file.

Code: Select all

chown nagios:nagios /usr/local/nagios/var/nagios.configtest
doesn't work unless I use sudo - I get "Operation not permitted".

And I can similarly chmod the file if I use sudo. However, that doesn't seem to help with running sudo /etc/rc.d/init.d/nagios start. When I dig into that script, the line that triggers the error is:

Code: Select all

if ! su $NagiosUser -c "touch $NagiosCfgtestFile"; then
		echo "ERROR: Could not create or update '$NagiosCfgtestFile'"
		exit 8
	fi
When I checked NagiosUser, though, it was blank. When I changed that to my username, I had to enter a password but I was able to run that 'su' line, but after changing that, running the start command still gives me the same error. It seems to be some sort of user permission issue, then, but I'm not sure what's going on beyond that.

Re: Problems installing/testing Nagios on OSX Sierra

Posted: Tue Sep 05, 2017 2:09 pm
by dwhitfield
Aelonia wrote: When I checked NagiosUser, though, it was blank. When I changed that to my username, I had to enter a password but I was able to run that 'su' line,
If you changed the file to be something specific, if should be nagios. What do you mean when you checked NagiosUser, it was blank? Are you saying you echoed the variable?

Re: Problems installing/testing Nagios on OSX Sierra

Posted: Tue Sep 05, 2017 4:20 pm
by Aelonia
dwhitfield wrote: If you changed the file to be something specific, if should be nagios. What do you mean when you checked NagiosUser, it was blank? Are you saying you echoed the variable?
Yeah, which I guess isn't terribly useful. Just really not sure why sudo /etc/rc.d/init.d/nagios start isn't working for me.

Re: Problems installing/testing Nagios on OSX Sierra

Posted: Tue Sep 05, 2017 4:26 pm
by dwhitfield
Aelonia wrote:
Yeah, which I guess isn't terribly useful.
Don't be so sure. If you don't have a nagios user, that could be a clue as to what is going on. Can you post your nagios.cfg? Also, what's the output of chage nagios -l

Also, is there a reason you need to install is on OS X? Why not just install it in Linux in a VM?

Re: Problems installing/testing Nagios on OSX Sierra

Posted: Tue Sep 05, 2017 5:46 pm
by Aelonia
I've attached my nagios.cfg file. Unfortunately, the 'chage' command doesn't seem to exist.

And I don't need it on OSX. I'm looking into database monitoring for a research project, so before I set up a VM or try to set it running on a linux server, since there were OSX instructions, it seemed easier to just try and get it running locally to see if it would meet my needs. Turns out to be way harder than I realized, and it's unclear to me what of the issues I'm experiencing are OSX related and what are just me being too inexperienced in this area to set it up correctly.

Re: Problems installing/testing Nagios on OSX Sierra

Posted: Wed Sep 06, 2017 9:22 am
by scottwilkerson
Lets do a quick test, edit /etc/rc.d/init.d/nagios

and change this line

Code: Select all

checkconfig="true"
to

Code: Select all

checkconfig="false"
Now lets try to start the service, I just want to make 100% sure the only problem is the configtest file

Re: Problems installing/testing Nagios on OSX Sierra

Posted: Wed Sep 06, 2017 11:50 am
by Aelonia
Yeah, that totally works.

I tried redoing the whole installation process one more time, and there were some warnings after running

Code: Select all

cd /tmp/nagioscore-nagios-4.3.4/
sudo ./configure --with-httpd-conf=/opt/local/apache2/conf/extra --with-gd-lib=/opt/local/lib --with-gd-inc=/opt/local/include
sudo make all
I've attached the output of sudo make all in case it's relevant.