Page 1 of 1

[SOLVED] Cannot start nagios automatically

Posted: Thu Apr 20, 2017 8:50 am
by sebastiaopburnay
Hi!

I've installed a nagios 4.3.1 on a 64 bit Ubuntu Server 16.04.

I can use the '/etc/init.d/nagios start' to start the nagios daemon and it works fine.

However, on boot, nagios does not start by itself.

When I try to run update-rc.d to register/enable nagios I get a warning I'm not understanding:

Code: Select all

root@srvtmsmon:~# update-rc.d nagios defaults
insserv: warning: current start runlevel(s) (2 3 4 5 S) of script `nagios' overrides LSB defaults (2 3 4 5).

root@srvtmsmon:~# update-rc.d nagios enable
insserv: warning: current start runlevel(s) (2 3 4 5 S) of script `nagios' overrides LSB defaults (2 3 4 5).
I have tried several init scripts:
a) the one created by the 'make install-init'
b) an altered version of the skeleton
c) a copies script from another host with nagios 4.x which works fine

I'm losing my imagination I couldn't find a post with an answer.

The closest I found was the one below, but it didn't work for me
ref = https://support.nagios.com/forum/viewt ... 7&t=11511

Re: Cannot start nagios automatically

Posted: Thu Apr 20, 2017 3:46 pm
by tgriep
Can you start nagios and enable it using systemctl?

Code: Select all

systemctl enable nagios.service
systemctl start nagios.service

Re: Cannot start nagios automatically

Posted: Thu Apr 20, 2017 3:53 pm
by dwhitfield
If @tgriep's suggestion doesn't work, you may need to reinstall the init

Code: Select all

cd /tmp
wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.3.1.tar.gz
tar xzf nagioscore.tar.gz
cd /tmp/nagioscore-nagios-4.3.1/
sudo ./configure --with-httpd-conf=/etc/apache2/sites-enabled
sudo make install-init
sudo update-rc.d nagios defaults

Re: Cannot start nagios automatically

Posted: Fri Apr 21, 2017 4:12 am
by sebastiaopburnay
tgriep wrote:Can you start nagios and enable it using systemctl?

Code: Select all

systemctl enable nagios.service
systemctl start nagios.service
I've tried but it made no diference:

Code: Select all

root@srvtmsmon:~# systemctl enable nagios.service
Synchronizing state of nagios.service with SysV init with /lib/systemd/systemd-sysv-install...
Executing /lib/systemd/systemd-sysv-install enable nagios
root@srvtmsmon:~# systemctl start nagios.service
root@srvtmsmon:~# ps -ef |grep nagios
root       1717   1591  0 10:10 pts/0    00:00:00 grep --color=auto nagios
root@srvtmsmon:~#

Re: Cannot start nagios automatically

Posted: Fri Apr 21, 2017 4:23 am
by sebastiaopburnay
dwhitfield wrote:If @tgriep's suggestion doesn't work, you may need to reinstall the init

Code: Select all

cd /tmp
wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.3.1.tar.gz
tar xzf nagioscore.tar.gz
cd /tmp/nagioscore-nagios-4.3.1/
sudo ./configure --with-httpd-conf=/etc/apache2/sites-enabled
sudo make install-init
sudo update-rc.d nagios defaults
It didn't work either.

When I run the 'sudo update-rc.d nagios defaults', the terminal didn't complain about LSB defaults, but the service does not start on boot either.

Re: Cannot start nagios automatically

Posted: Fri Apr 21, 2017 8:01 am
by dwhitfield
You may have done this but after going through my instructions use the enable command with systemctl. As long as it's registered with systemctl, enable should start it at boot.

Re: Cannot start nagios automatically

Posted: Thu Nov 16, 2017 9:45 am
by sebastiaopburnay
Ive trashed the previous VM, reinstalled Ubuntu and Nagios - SOLVED

Re: [SOLVED] Cannot start nagios automatically

Posted: Thu Nov 16, 2017 12:33 pm
by kyang
Sounds good! I'll be closing this thread!

If you have any more questions, feel free to create another thread.

Thanks for using the Nagios Support Forum!