如下,默认情况下,我们去检查 Nagios 语法的时候,如果语法错误,只会提示语法错误而不会提示详细的错误信息,因此我们有必要修改 Nagios 的启动配置脚本,使得执行 checkconfig 的时候能够出现详细的错误信息
[[email protected] ~]# /etc/init.d/nagios checkconfig Running configuration check... CONFIG ERROR! Check your Nagios configuration.
配置 Nagios 启动脚本:
[[email protected] ~]# vim /etc/init.d/nagios +178 checkconfig) printf "Running configuration check..." $NagiosBin -v $NagiosCfgFile;
[[email protected] ~]# /etc/init.d/nagios checkconfig Running configuration check... Nagios Core 3.5.1 Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors Copyright (c) 1999-2009 Ethan Galstad Last Modified: 08-30-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 ‘/usr/local/nagios/etc/objects/contacts.cfg‘... Processing object config file ‘/usr/local/nagios/etc/objects/timeperiods.cfg‘... Processing object config file ‘/usr/local/nagios/etc/objects/templates.cfg‘... Processing object config file ‘/usr/local/nagios/etc/objects/hosts.cfg‘... Processing object config file ‘/usr/local/nagios/etc/objects/services.cfg‘... Read object config files okay... Running pre-flight check on configuration data... Checking services... Checked 9 services. Checking hosts... Warning: Host ‘web02‘ has no services associated with it! Checked 2 hosts. Checking host groups... Checked 1 host groups. Checking service groups... Checked 0 service groups. Checking contacts... Checked 1 contacts. Checking contact groups... Checked 1 contact groups. Checking service escalations... Checked 0 service escalations. Checking service dependencies... Checked 0 service dependencies. Checking host escalations... Checked 0 host escalations. Checking host dependencies... Checked 0 host dependencies. Checking commands... Checked 25 commands. Checking time periods... Checked 5 time periods. Checking for circular paths between hosts... Checking for circular host and service dependencies... Checking global event handlers... Checking obsessive compulsive processor commands... Checking misc settings... Total Warnings: 1 Total Errors: 0 Things look okay - No serious problems were detected during the pre-flight check OK.
时间: 2024-10-08 23:38:41