Page 1 of 1

Cannot start nagios service

Posted: Wed Apr 08, 2020 10:35 am
by raul.hernandez
Hello, I'm installing Nagios Core 4.4.5 in a CentOS 7.7 server... I was able to make the web gui work but when I login I get the message below

Image

so I tried to start the service but I'm getting this error:

Code: Select all

[root@dev4server bin]# service nagios start
Redirecting to /bin/systemctl start nagios.service
Job for nagios.service failed because the control process exited with error code. See "systemctl status nagios.service" and "journalctl -xe" for details.
this is what it shows in journalctl -xe

Code: Select all

Apr 08 11:30:54 systemd[1]: Starting Nagios Core 4.4.5...
-- Subject: Unit nagios.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit nagios.service has begun starting up.
Apr 08 11:30:54 systemd[25826]: Failed at step EXEC spawning /usr/local/nagios/bin/nagios: Permission denied
-- Subject: Process /usr/local/nagios/bin/nagios could not be executed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The process /usr/local/nagios/bin/nagios could not be executed and failed.
--
-- The error number returned by this process is 13.
Apr 08 11:30:54 systemd[1]: nagios.service: control process exited, code=exited status=203
Apr 08 11:30:54 systemd[1]: Failed to start Nagios Core 4.4.5.
-- Subject: Unit nagios.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit nagios.service has failed.
--
-- The result is failed.
Apr 08 11:30:54 systemd[1]: Unit nagios.service entered failed state.
Apr 08 11:30:54 systemd[1]: nagios.service failed.
If I try to run this command: /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg I get this error even when doing it from root

Code: Select all

# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
-bash: /usr/local/nagios/bin/nagios: Permission denied
Can you help me out to fix this?
Thanks.

Re: Cannot start nagios service

Posted: Fri Apr 10, 2020 12:25 pm
by jdunitz
Could the permissions have gotten changed somehow?

What do you see when you do:

Code: Select all

ls -l /usr/local/nagios/bin/nagios
ls -l /usr/local/nagios/etc/nagios.cfg
If the permissions and ownership don't match this:

Code: Select all

[root@jpd-nagiosxi-one bin]# ls -l /usr/local/nagios/bin/nagios
-rwxrwxr--. 1 nagios nagios 713104 Jan 16 13:04 /usr/local/nagios/bin/nagios
[root@jpd-nagiosxi-one bin]# ls -l /usr/local/nagios/etc/nagios.cfg
-rw-rw-r-- 1 apache nagios 5657 Mar 24 09:56 /usr/local/nagios/etc/nagios.cfg
...then you'll need to fix them with:

Code: Select all

chown nagios:nagios /usr/local/nagios/bin/nagios
chmod 774 /usr/local/nagios/bin/nagios
chown apache:nagios /usr/local/nagios/etc/nagios.cfg
chmod 664 /usr/local/nagios/etc/nagios.cfg
I would also point out that if those files' permissions got messed up somehow, they're probably not the only ones, and there might be more fixing to do.

Hope that helps!
--Jeffrey

Re: Cannot start nagios service

Posted: Mon Apr 13, 2020 1:14 pm
by raul.hernandez
the chmod commands made the trick
thanks for your help! :D

Re: Cannot start nagios service

Posted: Mon Apr 13, 2020 1:22 pm
by scottwilkerson
raul.hernandez wrote:the chmod commands made the trick
thanks for your help! :D
Great!

Locking thread