我在CentOS 6.5上使用Nagios 3.2.3。 install过程中的一切都顺利进行。 我转移了我的conf文件,做了适当的更改,并对我的nagios.cfg文件进行了预飞testing。 在我的nagios.cfg文件中,我使用cfg_dir=/usr/local/nagios/etc/conf.d ,然后让Nagiosrecursionsearch该目录。
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg显示如下:
Website: http://www.nagios.org Reading configuration data... Read main config file okay... Processing object config directory '/usr/local/nagios/etc/conf.d'... Processing object config directory '/usr/local/nagios/etc/conf.d/hostgroups.d'... Processing object config file '/usr/local/nagios/etc/conf.d/hostgroups.d/hostgroups.cfg'... Processing object config directory '/usr/local/nagios/etc/conf.d/commands.d'... Processing object config file '/usr/local/nagios/etc/conf.d/commands.d/commands.cfg'... Processing object config directory '/usr/local/nagios/etc/conf.d/templates.d'... Processing object config file '/usr/local/nagios/etc/conf.d/templates.d/templates.cfg'... Processing object config file '/usr/local/nagios/etc/conf.d/templates.d/printer.cfg'... Processing object config file '/usr/local/nagios/etc/conf.d/templates.d/switch.cfg'... Processing object config file '/usr/local/nagios/etc/conf.d/templates.d/timeperiods.cfg'... Processing object config file '/usr/local/nagios/etc/conf.d/templates.d/windows.cfg'... Processing object config directory '/usr/local/nagios/etc/conf.d/objects'... Processing object config file '/usr/local/nagios/etc/conf.d/objects/previews-indexes-qa.cfg'... Processing object config file '/usr/local/nagios/etc/conf.d/objects/contacts.cfg'... Processing object config file '/usr/local/nagios/etc/conf.d/objects/restart_cb_sites.cfg'... Processing object config file '/usr/local/nagios/etc/conf.d/objects/hudson-slave01.cfg'... Processing object config file '/usr/local/nagios/etc/conf.d/objects/ipc-qa.cfg'... Processing object config file '/usr/local/nagios/etc/conf.d/objects/russellreynolds.cfg'... Processing object config file '/usr/local/nagios/etc/conf.d/objects/lr.cfg'... Processing object config file '/usr/local/nagios/etc/conf.d/objects/ts-01.cfg'... Processing object config file '/usr/local/nagios/etc/conf.d/cgi.cfg'... Error: Unexpected token or statement in file '/usr/local/nagios/etc/conf.d/cgi.cfg' on line 15. 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.
所以我检查第15行的cgi.cfg文件,它指向我的main_config_file=
################################################################# # # CGI.CFG - Sample CGI Configuration File for Nagios 3.4.4 # # Last Modified: 06-17-2009 # ################################################################# # MAIN CONFIGURATION FILE # This tells the CGIs where to find your main configuration file. # The CGIs will read the main and host config files for any other # data they might need. main_config_file=/usr/local/nagios/etc/nagios.cfg //line 15 here # PHYSICAL HTML PATH # This is the path where the HTML files for Nagios reside. This # value is used to locate the logo images needed by the statusmap # and statuswrl CGIs. physical_html_path=/usr/local/nagios/share
nagios.cfg故意在conf.d /目录之外。 列出的path也是正确的:
[root@ip-172-31-46-232 conf.d]# locate nagios.cfg /usr/local/nagios/etc/nagios.cfg
与@mdpc交谈之后,我再次检查了Nagios文档。 它根本不是很清楚,或者是你的脸上,但是它说:
默认情况下,Nagios希望CGIconfiguration文件被命名为cgi.cfg,并且与主configuration文件一起位于configuration文件目录中。
我把cgi.cfg和nagios.cfg回到同一个目录,并且很好。 我再次尝试了飞行前检查,遇到了完全相同的错误,但关于我的resource.cfg文件。 将configuration文件移动到与cgi和nagios文件相同的目录,并通过罚款。
所以现在我的/usr/local/nagios/etc/目录下的内容包括:
真正令人沮丧的是,在Nagios文档中没有任何地方明确指出cgi.cfg,nagios.cfg和resource.cfg文件都需要位于相同的目录中。
感谢您的build议,伙计们。
我遇到了同样的问题 – 事实certificate,问题不是文件必须在一个特定的path,而是相反 – 我试图使用一个resource.cfg文件从一个path也扫描使用cfg_dir定义 – 导致错误,因为$USERX$=xxx starts with an invalid token只要对象定义在nagios中$USERX$=xxx starts with an invalid token !
另一方面,当我从另一个path包含resource.cfg时,它一切正常!
希望这可以帮助有人试图解决这个问题:-)