首页 > 代码库 > Nagios 调试

Nagios 调试

如下,默认情况下,我们去检查 Nagios 语法的时候,如果语法错误,只会提示语法错误而不会提示详细的错误信息,因此我们有必要修改 Nagios 的启动配置脚本,使得执行 checkconfig 的时候能够出现详细的错误信息

[root@localhost ~]# /etc/init.d/nagios checkconfigRunning configuration check... CONFIG ERROR!  Check your Nagios configuration.

配置 Nagios 启动脚本:

[root@localhost ~]# vim /etc/init.d/nagios +178            checkconfig)                printf "Running configuration check..."                $NagiosBin -v $NagiosCfgFile;
[root@localhost ~]# /etc/init.d/nagios checkconfigRunning configuration check...Nagios Core 3.5.1Copyright (c) 2009-2011 Nagios Core Development Team and Community ContributorsCopyright (c) 1999-2009 Ethan GalstadLast Modified: 08-30-2013License: GPLWebsite: http://www.nagios.orgReading 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: 1Total Errors:   0Things look okay - No serious problems were detected during the pre-flight check OK.

 

 

 

 

    

Nagios 调试