Search code examples
linuxubuntunagios

Nagios - Error: Could not read object configuration data


We have a working version of Nagios 3.2.0 running on two other servers but on these new server we installed it using apt-get install but keep getting the following problem. The permissions and config file is all default from install and everything seems correct when comparing it to the working versions we have of Nagios...

Note: The Nagios website is running but when i click on any option on the left i get this...

Error: Could not read object configuration data!  
Verify configuration options using the -v command-line option to check for errors. 
Check the Nagios log file for messages relating to startup or status data errors.

Running

sudo /usr/sbin/nagios3 -v /etc/nagios3/nagios.cfg

Gives:

...
Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check

/var/log/nagios3/nagios.log gives no errors, just a bunch of:

...
[1389054450] Auto-save of retention data completed successfully.
[1389058050] Auto-save of retention data completed successfully.

Not a permission issue either tried changing everything to nagios user and group but no luck:

drwxr-xr-x   4 root root    4096 2013-12-10 16:35 .
drwxr-xr-x 141 root root   12288 2014-01-06 16:27 ..
-rw-r--r--   1 root root    1905 2011-06-08 01:07 apache2.conf
-rw-r--r--   1 root root   12218 2011-06-08 01:08 cgi.cfg
-rw-r--r--   1 root root    2441 2011-06-08 01:08 commands.cfg
drwxr-xr-x   2 root root    4096 2013-12-10 16:35 conf.d
-rw-r--r--   1 root root      26 2013-12-10 16:35 htpasswd.users
-rw-r--r--   1 root root   43769 2011-06-08 01:08 nagios.cfg
-rw-r-----   1 root nagios  1293 2011-06-08 01:07 resource.cfg
drwxr-xr-x   2 root root    4096 2013-12-10 16:35 stylesheets

Changed it back to root.

Stopped Nagios and restarted but still nothing. Please help!


Solution

  • Solved it a few days ago. Apache on these servers had been configured long ago to run as a different user, not www-data. This did not solve the problem we had back then so we left it as is and forgot about apache. Now that we have Nagios running on apache this caused the problem. So it was a permission issue in the end.

    Note: When checking if it is a permission issue, don't just check the file and directory permissions, check that what needs access to them is indeed running as that user in its configuration. In this case it was changed in /etc/apache2/envvars

    Lesson learnt.