Nagios 3.2.0 won't start as daemon - config problems.

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
spoko22
Posts: 6
Joined: Wed Sep 03, 2014 7:46 am

Nagios 3.2.0 won't start as daemon - config problems.

Post by spoko22 »

Hello,
I compiled and installed Nagios according to http://nagios.sourceforge.net/docs/3_0/ ... buntu.html. There is something wrong with my config though and I hope you could help me get on track.
My Nagios 3.2.0 was installed to /etc/nagios3.

1. Nagios won't run as daemon or as service - ALREADY FIXED SEE http://support.nagios.com/forum/viewtop ... 77#p110577
Nagios will run only, when deployed like

Code: Select all

/etc/nagios3/bin/nagios /etc/nagios3/etc/nagios.cfg
or

Code: Select all

nohup /etc/nagios3/bin/nagios /etc/nagios3/etc/nagios.cfg
However, it will not run when

Code: Select all

/etc/nagios3/bin/nagios -d /etc/nagios3/etc/nagios.cfg
(After I hit "Enter" button nothing more is shown, just next command prompt. Package daemon is installed)
or

Code: Select all

/etc/init.d/nagios start
I checked /etc/init.d/nagios script and directories there seem fine.
Terminal says: "Starting nagios: done.", however no new process is created. Still, I can type /etc/init.d/nagios stop and nagios is killed (always the same PID - 229).

2. Wrong site name - ALREADY FIXED SEE http://support.nagios.com/forum/viewtop ... 05#p110425
It is defined in cgi.cfg; cgi.cfg sits in /etc/nagios3/etc, next to nagios.cfg

Code: Select all

url_html_path=/nagios3
However, my apache2 seems to ignore it, as it creates my site as localhost/nagios instead of localhost/nagios3


My nagios.conf included in apache:

Code: Select all

ScriptAlias /nagios/cgi-bin "/etc/nagios3/sbin"

<Directory "/etc/nagios3/sbin">
#  SSLRequireSSL
   Options ExecCGI
   AllowOverride None
   Order allow,deny
   Allow from all
#  Order deny,allow
#  Deny from all
#  Allow from 127.0.0.1
   AuthName "Nagios Access"
   AuthType Basic
   AuthUserFile /etc/nagios3/etc/htpasswd.users
   Require valid-user
</Directory>

Alias /nagios "/etc/nagios3/share"

<Directory "/etc/nagios3/share">
#  SSLRequireSSL
   Options None
   AllowOverride None
   Order allow,deny
   Allow from all
#  Order deny,allow
#  Deny from all
#  Allow from 127.0.0.1
   AuthName "Nagios Access"
   AuthType Basic
   AuthUserFile /etc/nagios3/etc/htpasswd.users
   Require valid-user
</Directory>
Have you ever encountered problems like these?
Last edited by spoko22 on Fri Sep 05, 2014 3:17 am, edited 3 times in total.
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Nagios 3.2.0 won't start as daemon - config problems.

Post by eloyd »

Just curious - that is a very old version of Nagios. Is there a reason you're not using a newer version?
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
spoko22
Posts: 6
Joined: Wed Sep 03, 2014 7:46 am

Re: Nagios 3.2.0 won't start as daemon - config problems.

Post by spoko22 »

Yes, there is. This Nagios is going to be a backup copy for other Nagios working on different server (when this different server is down and it quite often is, I want to use this backup server for monitoring our targets). This original server's version 3.2.0, so I decided to install the same one, to make sure all configs are compatible and so on.
spoko22
Posts: 6
Joined: Wed Sep 03, 2014 7:46 am

Re: Nagios 3.2.0 won't start as daemon - config problems.

Post by spoko22 »

Okay, I fixed the wrong site address. What I needed to do was to change

Code: Select all

Alias /nagios "/etc/nagios3/share"
to

Code: Select all

Alias /nagios3 "/etc/nagios3/share"
However, I still cannot run nagios as daemon and I hope this post will bump my thread a little (please mods, don't be mad for double post, there are already two responses to this thread and I feel that's why nobody enters and reads it ;) ).
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Nagios 3.2.0 won't start as daemon - config problems.

Post by eloyd »

Regarding your daemon not starting, please post the output of:

Code: Select all

/etc/nagios3/bin/nagios -v -v /etc/nagios3/etc/nagios.cfg
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios 3.2.0 won't start as daemon - config problems.

Post by tmcdonald »

Thanks, eloyd, for taking point on this.
Former Nagios employee
spoko22
Posts: 6
Joined: Wed Sep 03, 2014 7:46 am

Re: Nagios 3.2.0 won't start as daemon - config problems.

Post by spoko22 »

OK guys, thanks for your assistance, but it looks like I worked my problems out. I will update my original question, so if anyone else is gonna look for the answer, this thread may be useful.

I found the reason why didn't my nagios start - directory /var/run/nagios3 was missing, so Nagios couldn't create nagios3.pid there. After mkdir and granting permission, daemon starts. I realized that by reading /var/log/nagios3/nagios.log.

However, I still wasn't able to stop my Nagios other way than

Code: Select all

ps aux | grep nagios
kill <pid>
That was fixed, by making the line from nagios.cfg

Code: Select all

lock_file=/var/run/nagios3/nagios3.pid
and the line from script /etc/init.d/nagios

Code: Select all

NagiosRunFile=/var/run/nagios3/nagios3.pid
point at the same file.
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Nagios 3.2.0 won't start as daemon - config problems.

Post by eloyd »

Glad to help @tm. Glad you figured out your issue, @spoko22.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Locked