Nagios

有沒有辦法更詳細地了解此錯誤消息“錯誤處理對象配置文件!”來自納吉奧斯

  • August 24, 2015

我正在從 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.

啟用調試輸出並將級別設置為 2 或 3(DEBUGL_FUNCTIONS 和 DEBUGL_CONFIG)。

(在查看原始碼時,我最初認為這是權限問題是錯誤的;對於“無法讀取目標文件”問題有一個特定的錯誤消息。)

如果調試輸出沒有任何幫助,您可以嘗試通過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");

這個函式 (in base/config.c) 只是設置一個選項標誌,然後呼叫read_object_config_data()返回通用 ERROR 的函式。

那個函式 (in common/objects.c) 真的只是呼叫xodtemplate_read_config_data.

真正的工作在xodtemplate_read_config_data(in xdata/xodtemplate.x) 中完成。因此,如果您想添加一些額外的調試輸出,那麼您可能應該這樣做。

引用自:https://serverfault.com/questions/578190