Page 1 of 1

Cannot open resource file

Posted: Sun Mar 12, 2017 11:22 pm
by t3dus
I'm running Nagios 4.1.1 on a Raspberry Pi and when i just changed some config files and ran "service nagios restart" i'm now getting this error below. The resource.cfg file DOES exist so i'm not sure why nagios.cfg can't open it.

root@raspberrypi:/usr/local/nagios/etc/objects# service nagios status -l
● nagios.service - Nagios
Loaded: loaded (/etc/systemd/system/nagios.service; enabled)
Active: failed (Result: exit-code) since Mon 2017-03-13 03:53:37 UTC; 50s ago
Process: 20876 ExecStart=/usr/local/nagios/bin/nagios /usr/local/nagios/etc/nagios.cfg (code=exited, status=1/FAILURE)
Main PID: 20876 (code=exited, status=1/FAILURE)
Mar 13 03:53:37 raspberrypi nagios[20876]: Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Mar 13 03:53:37 raspberrypi nagios[20876]: Copyright (c) 1999-2009 Ethan Galstad
Mar 13 03:53:37 raspberrypi nagios[20876]: Last Modified: 08-19-2015
Mar 13 03:53:37 raspberrypi nagios[20876]: License: GPL
Mar 13 03:53:37 raspberrypi nagios[20876]: Website: https://www.nagios.org
Mar 13 03:53:37 raspberrypi nagios[20876]: Error: Cannot open resource file '/usr/local/nagios/etc/resource.cfg' for reading!
Mar 13 03:53:37 raspberrypi nagios[20876]: Error in configuration file '/usr/local/nagios/etc/nagios.cfg' - Line 1384 (NULL)
Mar 13 03:53:37 raspberrypi nagios[20876]: Error: Failed to process config file '/usr/local/nagios/etc/nagios.cfg'. Aborting
Mar 13 03:53:37 raspberrypi systemd[1]: nagios.service: main process exited, code=exited, status=1/FAILURE
Mar 13 03:53:37 raspberrypi systemd[1]: Unit nagios.service entered failed state.

I need ideas on how to fix it.

Re: Cannot open resource file

Posted: Mon Mar 13, 2017 11:45 am
by tgriep
It could be that the permissions for that file was changed and the Nagios process cannot read it.
Try running the following to reset the permissions and see if that fixes the issue.

Code: Select all

chown nagios.nagios /usr/local/nagios/etc/resource.cfg
chmod 664 /usr/local/nagios/etc/resource.cfg

Re: Cannot open resource file

Posted: Mon Mar 13, 2017 11:57 am
by t3dus
Yep it was a permission issue. I sorted it out.

Thanks.

Re: Cannot open resource file

Posted: Mon Mar 13, 2017 12:25 pm
by cdienger
Thanks for the update. Are we okay closing the thread?