Page 1 of 1

nagios 4.0.6 - init script bug

Posted: Mon Jul 14, 2014 7:25 am
by GeoffMontee
I'm compiling Nagios 4.0.6 from source in a CentOS 6 environment in which I don't have root or sudo privileges. Therefore, Nagios only has a few users, groups, and directories it can work with.

I compiled with the following:

Code: Select all

./configure --prefix=/opt/nagios --with-nagios-user=monitor --with-nagios-group=monitor --with-command-user=monitor --with-command-group=monitor --with-init-dir=/home/monitor/scripts --with-lockfile=/home/monitor/nagios.lock --with-httpd-conf=/home/monitor/conf/httpd
make all
make install
mkdir -p /home/monitor/scripts
make --ignore-errors install-init
make install-commandmode
make install-config
mkdir -p /home/monitor/conf/httpd
make --ignore-errors install-webconf
make install-exfoliation
Then I try to start nagios, and get permission denied errors:

Code: Select all

> bash /home/monitor/scripts/nagios start
Starting nagios: /home/monitor/scripts/nagios: line 89: /var/run/nagios.configtest: Permission denied
chmod: cannot access `/var/run/nagios.configtest': No such file or directory
touch: cannot touch `/var/lock/subsys/nagios': Permission denied
There seems to be several places in the init script that ignore configure flags and opt for the standard Red Hat locations instead. Some examples:
  1. Line 63: NagiosLockDir is set to "/var/lock/subsys" despite setting --with-lockfile during configure.
  2. Line 89-90, 97-98, 105-106: Config test tries to work with /var/run/nagios.configtest, despite setting --with-prefix during configure.
For my current setup, I can obviously alter the init script to make it work for myself. But I thought I would report this bug, so you could fix it in future releases.

This is unrelated, but you'll notice that I had to pass --ignore-errors to make during two of the steps. To avoid derailing this thread, I'll post the issue that caused that in a separate thread.

Re: nagios 4.0.6 - init script bug

Posted: Mon Jul 14, 2014 11:39 am
by abrist
I will bring one of our core devs into this thread. Could you by chance open an issue on github as well?
https://github.com/NagiosEnterprises/nagioscore/issues

Re: nagios 4.0.6 - init script bug

Posted: Mon Jul 14, 2014 4:36 pm
by GeoffMontee
Thanks for the response. Posted as issue #7.

Re: nagios 4.0.6 - init script bug

Posted: Mon Jul 14, 2014 4:59 pm
by slansing
Great! Just keep an eye on that tracker link for an update from the Devs when they have an answer for you. We can likely chalk this up to non-standard usage, but they will let you know. Thank you for posting the link for others in the future!