主配置文件[--prefix/nagios/etc/nagios.cfg]:

##############################################################################
#
# NAGIOS.CFG - Sample Main Config File for Nagios 3.0.6
#
# Read the documentation for more information on this configuration
# file.  I've provided some comments here, but things may not be so
# clear without further explanation.
#
# Last Modified: 10-15-2008
#
##############################################################################
 
# LOG FILE
# This is the main log file where service and host events are logged
# for historical purposes.  This should be the first option specified
# in the config file!!!
# 这个变量用于设定Nagios在何处创建其日志文件。
# 它应该是你主配置文件里面的第一个变量,当Nagios找到你配置文件并发现配置里有错误时会向该文件中写入错误信息。
# 如果你使能了日志回滚,Nagios将在每小时、每天、每周或每月对日志进行回滚。
 
log_file=/usr/local/nagios/var/nagios.log
 
# OBJECT CONFIGURATION FILE(S)
# 对象的配置文件
# These are the object configuration files in which you define hosts,
# host groups, contacts, contact groups, services, etc.
# You can split your object definitions across several config files
# if you wish (as shown below), or keep them all in a single config file.
# 该变量用于指定一个包含有将用于Nagios监控对象的对象配置文件。
# 对象配置文件中包括有主机、主机组、联系人、联系人组、服务、命令等等对象的定义。
# 配置信息可以切分为多个文件并且用cfg_file=语句来指向每个待处理的配置文件
 
# You can specify individual object config files as shown below:
# 您可以指定单个对象的配置文件, 如下所示:
cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/templates.cfg
 
# Definitions for monitoring the local (Linux) host
# 定义监测本地( Linux )主机
cfg_file=/usr/local/nagios/etc/objects/localhost.cfg
 
# Definitions for monitoring a Windows machine
# 定义监测( windows )主机
#cfg_file=/usr/local/nagios/etc/objects/windows.cfg
 
# Definitions for monitoring a router/switch
# 定义监测路由器或交换机
#cfg_file=/usr/local/nagios/etc/objects/switch.cfg
 
# Definitions for monitoring a network printer
# 定义监测打印机
#cfg_file=/usr/local/nagios/etc/objects/printer.cfg
 
# You can also tell Nagios to process all config files (with a .cfg
# extension) in a particular directory by using the cfg_dir
# directive as shown below:
# 您也可以告诉Nagios处理所有配置文件(带有.cfg扩展名)在特定的目录使用cfg_dir指令如下所示:
 
#cfg_dir=/usr/local/nagios/etc/servers
#cfg_dir=/usr/local/nagios/etc/printers
#cfg_dir=/usr/local/nagios/etc/switches
#cfg_dir=/usr/local/nagios/etc/routers

配置文件里的变量:

日志文件

格式:    log_file=<file_name>
样例:    log_file=/usr/local/nagios/var/nagios.log

说明:

这个变量用于设定Nagios在何处创建其日志文件。它应该是你主配置文件里面的第一个变量,当Nagios找到你配置文件并发现配置里有错误时会向该文件中写入错误信息。如果你使能了日志回滚,Nagios将在每小时、每天、每周或每月对日志进行回滚。

对象配置文件

格式:    cfg_file=<file_name>
样例:
cfg_file=/usr/local/nagios/etc/hosts.cfg
cfg_file=/usr/local/nagios/etc/services.cfg
cfg_file=/usr/local/nagios/etc/commands.cfg

说明:

该变量用于指定一个包含有将用于Nagios监控对象的对象配置文件。对象配置文件中包括有主机、主机组、联系人、联系人组、服务、命令等等对象的定义。配置信息可以切分为多个文件并且用cfg_file=语句来指向每个待处理的配置文件.

对象配置目录:

格式:    cfg_dir=<directory_name>
样例:
cfg_dir=/usr/local/nagios/etc/commands
cfg_dir=/usr/local/nagios/etc/services
cfg_dir=/usr/local/nagios/etc/hosts

说明:

该变量用于指定一个目录,目录里包含有将用于Nagios监控对象的对象配置文件。所有的在这个目录下的且以.cfg为扩展名的文件将被作为配置文件来处理。另外,Nagios将会递归该目录下的子目录并处理其子目录下的全部配置文件。你可以把配置放入不同的目录并且用cfg_dir=语句来指向每个待处理的目录。

 

Posted on 2010-12-12 12:59  技术人生  阅读(337)  评论(0编辑  收藏  举报