Installing Nagios 4.0.2 on Centos 7 – service fails to start

centos7nagios

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

Best Answer

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.