I am migrating from Nagios 3.2.3 to 4.02 and I am stuck with a non-specific error message:
Is there a way to coax some more detail out of Nagios Core? I get no clue from the attached error output what might be wrong, or even which .cfg file is the culprit.
/usr/local/nagios/bin/nagios -vvvvvv /usr/local/nagios/etc/nagios.cfg
Nagios Core 4.0.2
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 11-25-2013
License: GPL
Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Processing object config file '/usr/local/nagios/etc/objects/commands.cfg'...
Processing object config file '/etc/nagios/objects/contacts.cfg'...
Processing object config file '/etc/nagios/objects/escalations.cfg'...
Processing object config file '/etc/nagios/objects/timeperiods.cfg'...
Processing object config file '/etc/nagios/objects/templates.cfg'...
Processing object config file '/etc/nagios/objects/signal-hosts.cfg'...
Processing object config file '/etc/nagios/objects/servicechecks.cfg'...
Processing object config file '/etc/nagios/objects/passivechecks.cfg'...
Processing object config file '/etc/nagios/objects/websites/aws1-checkwebservices.cfg'...
Processing object config file '/etc/nagios/objects/websites/aws2-checkwebservices.cfg'...
Processing object config file '/etc/nagios/objects/websites/awscabot-checkwebservices.cfg'...
Processing object config file '/etc/nagios/objects/others.cfg'...
Error processing object config files!
***> One or more problems was encountered while processing the config files...
Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.
Best Answer
Enable debug output and set the level to 2 or 3 (DEBUGL_FUNCTIONS and DEBUGL_CONFIG).
(Upon looking at the source, my original thought about it being a permissions problem was wrong; There's a specific error message for "can't read object file" problems.)
If there's nothing helpful in the debug output, you can try running it through
strace
. If that isn't an option, or isn't helpful, you'll have to hack on the source a bit to get more info.In case you actually want to do this:
Your error is the very-generic one caused by (
base/nagios.c
lines 435-438):This function (in
base/config.c
) just sets an option flag and then callsread_object_config_data()
, which returns the generic ERROR.That function (in
common/objects.c
) really just callsxodtemplate_read_config_data
.The real work is done in
xodtemplate_read_config_data
(inxdata/xodtemplate.x
). So if you wanted to add some additional debug output, that's probably where you should do it.