1

Having followed the instructions here http://linoxide.com/how-tos/install-configure-nagios-centos-7/ (but downloading Nagios 4.0.2 instead of 4.0.7 - I have to use that version), I have reached a point where the Nagios service won't start.

The commands I'm trying are -

[root@my-server]# service nagios start
Starting nagios (via systemctl):  Job for nagios.service failed. See 'systemctl status     nagios.service' and 'journalctl -xn' for details.
                                                       [FAILED]

[root@my-server]# systemctl status nagios.service
nagios.service - LSB: start and stop Nagios monitoring server
   Loaded: loaded (/etc/rc.d/init.d/nagios)
   Active: failed (Result: resources) since Wed 2014-11-05 11:40:27 GMT; 1min 0s ago
  Process: 23314 ExecStart=/etc/rc.d/init.d/nagios start (code=exited, status=5)

Nov 05 11:40:27 centos-server systemd[1]: Starting LSB: start and stop Nagios monitoring server...
Nov 05 11:40:27 centos-server nagios[23314]: nagios is stopped
Nov 05 11:40:27 centos-server systemd[1]: PID file /var/nagios/nagios.pid not readable (yet?) after start.
Nov 05 11:40:27 centos-server systemd[1]: Failed to start LSB: start and stop Nagios monitoring server.
Nov 05 11:40:27 centos-server systemd[1]: Unit nagios.service entered failed state.

That /var/nagios/nagios.pid file doesn't exist. Initially, the /var/nagios directory didn't exist, so I created it. I've tried changing its owner to nagios and I've tried changing its owner to root.

If I create an empty pid file then try starting the service again I get an error saying it contains an invalid value, then it gets deleted.

Also interesting - I couldn't verify the Nagios config as suggested in those instructions because /usr/local/nagios/bin/nagios doesn't exist. Not sure what's happened to that.

Any clues?

Thanks

2 Answers 2

0

The answer to this appeared to be re-running the various make install-* commands. I didn't see any errors during the first install, but it looks like some aspects failed anyway - most notably the missing /usr/local/nagios/bin directory.

After that service nagios start hangs for several minutes, then claims to have timed out. Despite this, Nagios seems to be running.

I also had to open port 80.

0

This answer assumes you are installing using yum from EPEL. If you install from source, the files may be in different locations but the ideas are the same. Make sure the nagios user has permission to these files.

That /var/nagios/nagios.pid file doesn't exist. Initially, the /var/nagios directory didn't exist, so I created it.

Look for this section in /etc/nagios/nagios.cfg

# LOCK FILE
# This is the lockfile that Nagios will use to store its PID number
# in when it is running in daemon mode.
lock_file=/var/run/nagios/nagios.pid

That is the file Nagios will create when it starts up. Older versions might use nagios.lock, or the path might be something like /usr/local/nagios/

If I create an empty pid file then try starting the service again I get an error saying it contains an invalid value, then it gets deleted.

You shouldn't do this! systemd will create/delete it on it's own.

systemd specifies the pid file it is looking for in /lib/systemd/system/nagios.service

PIDFile=/var/run/nagios/nagios.pid

This needs to be the same as lock_file in your nagios.cfg, or systemd will timeout and stop your nagios service.

Also interesting - I couldn't verify the Nagios config as suggested in those instructions because /usr/local/nagios/bin/nagios doesn't exist. Not sure what's happened to that.

Run the command whereis nagios to find it. It's likely located in /usr/sbin/nagios

If you want to see related messages to this issue, run fgrep 'systemd' messages | fgrep -i nagios from /var/log/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .