Cannot start nagios service

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
raul.hernandez
Posts: 5
Joined: Wed Apr 08, 2020 10:02 am

Cannot start nagios service

Post 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.
User avatar
jdunitz
Posts: 235
Joined: Wed Feb 05, 2020 2:50 pm

Re: Cannot start nagios service

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
raul.hernandez
Posts: 5
Joined: Wed Apr 08, 2020 10:02 am

Re: Cannot start nagios service

Post by raul.hernandez »

the chmod commands made the trick
thanks for your help! :D
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Cannot start nagios service

Post by scottwilkerson »

raul.hernandez wrote:the chmod commands made the trick
thanks for your help! :D
Great!

Locking thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked