有没有办法更详细的从Nagios这个错误消息“error handling对象configuration文件!

我正在从Nagios 3.2.3迁移到4.02,并且遇到了一个非特定的错误消息:有没有办法从Nagios Core中哄一些更多的细节? 我不知道附件的错误输出可能是错误的,甚至哪个.cfg文件是罪魁祸首。

/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. 

启用debugging输出并将级别设置为2或3(DEBUGL_FUNCTIONS和DEBUGL_CONFIG)。

(在查看源代码时,我原来认为是权限问题是错误的;“无法读取对象文件”问题有一个特定的错误信息。)

如果在debugging输出中没有任何帮助,可以尝试通过strace运行。 如果这不是一个选项,或者是没有帮助,你将不得不破解源代码来获取更多的信息。

如果你真的想这样做:

你的错误是由( base/nagios.c行435-438)引起的非常通用的错误:

 /* read object config files */ result = read_all_object_data(config_file); if(result != OK) { printf(" Error processing object config files!\n\n"); 

这个函数(在base/config.c )只是设置一个选项标志,然后调用read_object_config_data() ,它返回通用的ERROR。

该函数(在common/objects.c )实际上只是调用xodtemplate_read_config_data

真正的工作是在xodtemplate_read_config_data (在xdata/xodtemplate.x )中完成的。 所以,如果你想添加一些额外的debugging输出,这可能是你应该做的。