Cannot open resource file

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
User avatar
t3dus
Posts: 161
Joined: Thu Feb 04, 2016 3:46 pm
Location: IA
Contact:

Cannot open resource file

Post 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.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Cannot open resource file

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
t3dus
Posts: 161
Joined: Thu Feb 04, 2016 3:46 pm
Location: IA
Contact:

Re: Cannot open resource file

Post by t3dus »

Yep it was a permission issue. I sorted it out.

Thanks.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Cannot open resource file

Post by cdienger »

Thanks for the update. Are we okay closing the thread?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked