Failed to start nagios

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.
Locked
Sander5
Posts: 37
Joined: Wed Sep 04, 2013 5:15 am

Failed to start nagios

Post by Sander5 »

hello!

Clean install of Nagios 4.1.1 on debian 8 jessie.

I followed the quickstart install: https://assets.nagios.com/downloads/nag ... buntu.html
Wich is outdated but i managed to use it. it still works, only 2 details did not work you need unzip and:

Code: Select all

5) Configure the Web Interface

Install the Nagios web config file in the Apache conf.d directory.

make install-webconf
It failed, i then searched the internet: http://www.unixmen.com/how-to-install-n ... ntu-15-04/

Code: Select all

Install Nagios Web interface:

Enter the following commands to compile and install nagios web interface.

sudo make install-webconf
You may get the following error:

/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/httpd/conf.d/nagios.conf
 /usr/bin/install: cannot create regular file ‘/etc/httpd/conf.d/nagios.conf’: No such file or directory
 Makefile:296: recipe for target 'install-webconf' failed
 make: *** [install-webconf] Error 1
The above error message describes that nagios is trying to create the nagios.conf file inside the /etc/httpd.conf/directory. But, in Ubuntu systems the nagios.conf file should be placed in /etc/apache2/sites-enabled/directory.

So, run the following command instead of using sudo make install-webconf.

sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-enabled/nagios.conf
Check if nagios.conf is placed in /etc/apache2/sites-enabled directory.

sudo ls -l /etc/apache2/sites-enabled/
Sample output:

total 4
lrwxrwxrwx 1 root root 35 Aug 4 15:54 000-default.conf -> ../sites-available/000-default.conf
-rw-r--r-- 1 root root 982 Aug 4 16:19 nagios.conf
but the real problem is this:

Code: Select all

/etc/init.d/nagios start
[....] Starting nagios (via systemctl): nagios.serviceFailed to start nagios.service: Unit nagios.service failed to load: No such file or directory.
 failed! 
service nagios start
Failed to start nagios.service: Unit nagios.service failed to load: No such file or directory.

I did the "hack" for the init script (somewhere on the forum). it worked partly....it is very weird. a restart of the nagios services takes a very long time. the website says the service is running. but the restart command fails (after a long time).
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Failed to start nagios

Post by jdalrymple »

I use this on EL7 and it pretty well works:

Code: Select all

[Unit]
Description=Nagios Core Monitoring Daemon
After=network.target

[Service]
User=nagios
Group=nagios
Type=forking
ExecStart=/usr/lib/systemd/scripts/nagios start
ExecStop=/usr/lib/systemd/scripts/nagios stop
ExecReload=/usr/lib/systemd/scripts/nagios reload

[Install]
WantedBy=multi-user.target
You have to copy /etc/init.d/nagios (the init system script) to /usr/lib/systemd/scripts/nagios

That's my hack. Does it not work for you?
Sander5
Posts: 37
Joined: Wed Sep 04, 2013 5:15 am

Re: Failed to start nagios

Post by Sander5 »

Yes thanks! i think it works

I am still figuring out how to make it run at startup/reboot. there are some errors. but i think i can manage that. (i hope :D ) (edit: it runs at startup successfully now)
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Failed to start nagios

Post by hsmith »

Sander5 wrote:Yes thanks! i think it works

I am still figuring out how to make it run at startup/reboot. there are some errors. but i think i can manage that. (i hope :D ) (edit: it runs at startup successfully now)
Glad to hear that you have it working so far. I'll leave this thread open in case you want to include any specific errors for us to troubleshoot with you.
Former Nagios Employee.
me.
Sander5
Posts: 37
Joined: Wed Sep 04, 2013 5:15 am

Re: Failed to start nagios

Post by Sander5 »

Everything is working, no errors or problems.

Thanks again, the thread can be closed.
Locked