Nagios配置文件详解

回复 收藏
Nagios配置文件详解

这里开始要讲一些Nagios的配置。

首先要看看目前Nagios的主配置路径下有哪些文件。
[root@nagios etc]# ll
总用量 152
-rwxrwxr-x. 1 nagios nagios 1825 9月  24 14:40 cgi.cfg
-rwxrwxr-x. 1 nagios nagios 9747 9月  24 14:40 checkcommands.cfg
-rwxrwxr-x. 1 nagios nagios 1089 9月  24 14:40 connectors.cfg
-rwxrwxr-x. 1 nagios nagios 1352 9月  24 14:40 contactgroups.cfg
-rwxrwxr-x. 1 nagios nagios 1539 9月  24 14:40 contacts.cfg
-rwxrwxr-x. 1 nagios nagios 1089 9月  24 14:40 contactTemplates.cfg
-rwxrwxr-x. 1 nagios nagios 1089 9月  24 14:40 dependencies.cfg
-rwxrwxr-x. 1 nagios nagios 1089 9月  24 14:40 escalations.cfg
-rwxrwxr-x. 1 nagios nagios 1211 9月  24 14:40 hostgroups.cfg
-rwxrwxr-x. 1 nagios nagios 1956 9月  24 14:40 hosts.cfg
-rwxrwxr-x. 1 nagios nagios 2949 9月  24 14:40 hostTemplates.cfg
-rwxrwxr-x. 1 apache nagios   26 6月   3 2013 htpasswd.users
-rwxrwxr-x. 1 nagios nagios 1573 9月  24 14:40 meta_commands.cfg
-rwxrwxr-x. 1 nagios nagios 1089 9月  24 14:40 meta_contact.cfg
-rwxrwxr-x. 1 nagios nagios 1089 9月  24 14:40 meta_contactgroup.cfg
-rwxrwxr-x. 1 nagios nagios 1089 9月  24 14:40 meta_dependencies.cfg
-rwxrwxr-x. 1 nagios nagios 1089 9月  24 14:40 meta_escalations.cfg
-rwxrwxr-x. 1 nagios nagios 1089 9月  24 14:40 meta_host.cfg
-rwxrwxr-x. 1 nagios nagios 1089 9月  24 14:40 meta_hostgroup.cfg
-rwxrwxr-x. 1 nagios nagios 1089 9月  24 14:40 meta_services.cfg
-rwxrwxr-x. 1 nagios nagios 1341 9月  24 14:40 meta_timeperiod.cfg
-rwxrwxr-x. 1 nagios nagios 5683 9月  24 14:40 misccommands.cfg
-rwxrwxr-x. 1 nagios nagios 4170 9月  24 14:40 nagios.cfg
-rwxrwxr-x. 1 nagios nagios 1448 9月  24 14:40 ndo2db.cfg
-rwxrwxr-x. 1 nagios nagios 1351 9月  24 14:40 ndomod.cfg
-rwxrwxr-x. 1 nagios nagios 7988 6月   3 2013 nrpe.cfg
drwxrwxr-x. 2 nagios nagios 4096 6月   3 2013 objects
-rwxrwxr-x. 1 nagios nagios 1158 9月  24 14:40 resource.cfg
-rwxrwxr-x. 1 nagios nagios 1236 9月  24 14:40 servicegroups.cfg
-rwxrwxr-x. 1 nagios nagios 2244 9月  24 14:40 services.cfg
-rwxrwxr-x. 1 nagios nagios 5533 9月  24 14:40 serviceTemplates.cfg
-rwxrwxr-x. 1 nagios nagios 2138 9月  24 14:40 timeperiods.cfg

Nagios主配置文件:
Nagios的主配置文件为/etc/nagios/nagios.cfg,在进行操作前首先要对主配置文件进行备份。
# cp /etc/nagios/nagios.cfg /etc/nagios/nagios.cfg.backup

配置Nagios的主配置文件:

# vi /etc/nagios/nagios.cfg
--------------------------------------------------------------------------------
第一部分:日志文件
# 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!!!
日志文件,用来记录主机活动事件的主要日志文件文件,这应该是配置文件中位于最首的。

log_file=/var/log/nagios/nagios.log
设定Nagios的主日志文件路径。

第二部分:对象配置文件模块
# OBJECT CONFIGURATION FILE(S)
# This is the configuration file in which you define hosts, host
# groups, contacts, contact groups, services, etc.  I guess it would
# be better called an object definition file, but for historical
# reasons it isn't.  You can split object definitions into several
# different config files by using multiple cfg_file statements here.
# Nagios will read and process all the config files you define.
# This can be very useful if you want to keep command definitions
# separate from host and contact definitions...
对象配置文件。这些配置文件将会分别用来定义主机、主机组、联系人、联系人组、服务、等等。这些更应当被理解为“对象定义”文件较为贴切。
可以通过将一些对象通过多个不同独立的cfg_file语句指明的配置文件分开定义。
Nagios将会读取并且处理所有这些配置文件中记载的定义。
对于需要将命令定义和其他类似于主机、联系人等定义分开处理记录的话,将会非常有用。
# Command definitions
cfg_file=/etc/nagios/commands.cfg
设定命令定义配置文件路径。


# Host and service definitions for monitoring this machine
cfg_file=/etc/nagios/localhost.cfg
设定主机和服务监视定义配置文件路径。

# You can split other types of object definitions across several
# config files if you wish (as done here), or keep them all in a
# single config file.
以下则是其它类型细分定义的配置文件,也可以将它们全部写在一张配置文件当中。这些默认是加注的,如果要启用的话需要手动解注。而且这些文件默认也是没有的,如果要启用还必须手动建立它们。

#cfg_file=/etc/nagios/contactgroups.cfg
#cfg_file=/etc/nagios/contacts.cfg
#cfg_file=/etc/nagios/dependencies.cfg
#cfg_file=/etc/nagios/escalations.cfg
#cfg_file=/etc/nagios/hostgroups.cfg
#cfg_file=/etc/nagios/hosts.cfg
#cfg_file=/etc/nagios/services.cfg
#cfg_file=/etc/nagios/timeperiods.cfg
#cfg_dir=/etc/nagios/servers
#cfg_dir=/etc/nagios/printers
#cfg_dir=/etc/nagios/switches
#cfg_dir=/etc/nagios/routers

# Extended host/service info definitions are now stored along with
# other object definitions:
以下是一些扩展的主机/服务信息定义配置文件。

#cfg_file=/etc/nagios/hostextinfo.cfg
#cfg_file=/etc/nagios/serviceextinfo.cfg

第三部分:对象缓存文件
# OBJECT CACHE FILE
# This option determines where object definitions are cached when
# Nagios starts/restarts.  The CGIs read object definitions from
# this cache file (rather than looking at the object config files
# directly) in order to prevent inconsistencies that can occur
# when the config files are modified after Nagios starts.
对象缓存文件。这些选项将决定当Nagios启动时或重新启动时,对象定义将被缓存在什么地方。CGI将从这个对象文件中读取对象的定义,而不是在之前的对象配置文件路径中去找。这样做是为了避免修改Nagios配置文件后引起的不一致问题。换句简单的话说就是更改配置文件后要重新运新Nagios新的配置参数才会生效,而当前运行的Nagios只参考缓存中的配置参数而已。

object_cache_file=/var/log/nagios/objects.cache
设定对象缓存文件的路径。

第四部分:状态文件
# STATUS FILE
# This is where the current status of all monitored services and
# hosts is stored.  Its contents are read and processed by the CGIs.
# The contents of the status file are deleted every time Nagios
#  restarts.
状态文件。这个文件将保存着目前检测到的服务和主机数据信息。这个文件当中的内容是被CGI读取并处理的,而它也是在每次Nagios重新启动的时候被删除清空的。

status_file=/var/log/nagios/status.dat
设定状态文件的路径。

第五部分:Nagios服务宿主用户
# NAGIOS USER
# This determines the effective user that Nagios should run as.
# You can either supply a username or a UID.
支撑Nagios服务运行的用户。貌似默认安装后没有这个用户,如果没有的话,手动建立一个。

nagios_user=nagios
默认情况下宿主用户就是nagios。

第六部分:Nagios服务宿主用户组
# NAGIOS GROUP
# This determines the effective group that Nagios should run as.
# You can either supply a group name or a GID.
支撑Nagios服务运行的用户组。貌似安装后也没,如果没有的话,和用户一起手动建立。

nagios_group=nagios
默认情况下宿主用户组就是nagios。

第七部分:外部命令选项
# EXTERNAL COMMAND OPTION
# This option allows you to specify whether or not Nagios should check
# for external commands (in the command file defined below).  By default
# Nagios will *not* check for external commands, just to be on the
# cautious side.  If you want to be able to use the CGI command interface
# you will have to enable this.  Setting this value to 0 disables command
# checking (the default), other values enable it.
外部命令选项。这个选项允许用户指定是否Nagios应该对外部的命令进行检查。默认下,Nagios将不会检查外部命令,如果需要能够使用CGI命令接口的话,那么就必须要启用这个选项。设定0值表示关闭命令检查(默认),其它值表示启用。

#check_external_commands=0
check_external_commands=1
设定是否检测外部命令。默认是不启用的,但是由于需要配合Apache工作,在Web界面下进行Nagiso的控制和管理的话,必须要将此项打开。


第八部分:外部命令检测时间间隔
# EXTERNAL COMMAND CHECK INTERVAL
# This is the interval at which Nagios should check for external commands.
# This value works of the interval_length you specify later.  If you leave
# that at its default value of 60 (seconds), a value of 1 here will cause
# Nagios to check for external commands every minute.  If you specify a
# number followed by an "s" (i.e. 15s), this will be interpreted to mean
# actual seconds rather than a multiple of the interval_length variable.
# Note: In addition to reading the external command file at regularly
# scheduled intervals, Nagios will also check for external commands after
# event handlers are executed.
# NOTE: Setting this value to -1 causes Nagios to check the external
# command file as often as possible.
这个配置选项是用来指定外部命令检测的频率。默认值-1表示Nagios将会尽可能频繁地进行检测。这里的配置的数值如果不加上单位的话,默认单位表示分钟,如1就是表示1分钟,Nagios每分钟检测一次。如果要指定单位是秒的话,那么需要在数值后面跟上s,如15s就表示15秒。

command_check_interval=15s
#command_check_interval=-1
设定外部命令检测时间间隔。默认值是-1,Nagios会尽可能频繁地进行检测,这样会造成系统资源换的巨大消耗。这里还是建议将此条注释,而将另外一条备选的15s的项解注,让Nagios每15秒进行一次检测好了。具体值请根据具体情况决定。

第九部分:外部命令文件
# EXTERNAL COMMAND FILE
# This is the file that Nagios checks for external command requests.
# It is also where the command CGI will write commands that are submitted
# by users, so it must be writeable by the user that the web server
# is running as (usually 'nobody').  Permissions should be set at the
# directory level instead of on the file, as the file is deleted every
# time its contents are processed.
这是Nagios用来检查外部命令请求的文件。这个文件同样也是用户操作提交与CGI命令写入的地方,所以这个文件必须对于相关服务可写,一般是针对Apache的宿主用户可写。并且注意,这个文件所在的目录的权限必须被Apache可写,而不单指这文件,因为这个文件在工作当中是频繁被删除的。(之前我们将Apahe归入Nagios组的时候就已经完成了)

command_file=/var/log/nagios/rw/nagios.cmd
设定外部命令文件的路径。

第十部分:外部命令缓冲插槽
# EXTERNAL COMMAND BUFFER SLOTS
# This settings is used to tweak the number of items or "slots" that
# the Nagios daemon should allocate to the buffer that holds incoming
# external commands before they are processed.  As external commands
# are processed by the daemon, they are removed from the buffer.
这里将设定Nagios守护进程对接收进来的外部命令进行处理前的缓冲区大小。一旦一个外部命令被Nagios守护进程处理完了之后就会被从缓冲区删除掉。

external_command_buffer_slots=4096
设置外部命令缓存区大小。

第十一部分:注解文件
# COMMENT FILE
# This is the file that Nagios will use for storing host and service
# comments.
这是Nagios用来保存主机和服务的注解信息的文件。

comment_file=/var/log/nagios/comments.dat
设定注解文件的路径。

第十二部分:故障时间文件
# DOWNTIME FILE
# This is the file that Nagios will use for storing host and service
# downtime data.
这是Nagios用来记录主机和服务故障停机时间数据的文件。

downtime_file=/var/log/nagios/downtime.dat
设定故障时间文件。

第十三部分:锁定文件
# LOCK FILE
# This is the lockfile that Nagios will use to store its PID number
# in when it is running in daemon mode.
这是Nagios在守护进程模式运行时用来保存它的PID号的文件。

lock_file=/var/run/nagios.pid
设定Nagios的PID文件。

第十四部分:临时文件
# TEMP FILE
# This is a temporary file that is used as scratch space when Nagios
# updates the status log, cleans the comment file, etc.  This file
# is created, used, and deleted throughout the time that Nagios is
# running.
这是当Nagios更新状态日至、清除注解文件等等工作时暂时保留文件内容的临时文件。它将在Nagios运行时不停地被建立、使用和删除。
temp_file=/var/log/nagios/nagios.tmp
设定临时文件的路径。

第十五部分:事件代理选项
# EVENT BROKER OPTIONS
# Controls what (if any) data gets sent to the event broker.
# Values:  0      = Broker nothing
#         -1      = Broker everything
#          = See documentation
控制事件代理将受理什么样的数据。设定0值时表示不代理任何东西,设定-1值时表示代理任何信息,设定其它值的话要参考专门的手册。

event_broker_options=-1
设定事件代理。默认值就是-1。

第十六部分:事件代理模块
# EVENT BROKER MODULE(S)
# This directive is used to specify an event broker module that should
# by loaded by Nagios at startup.  Use multiple directives if you want
# to load more than one module.  Arguments that should be passed to
# the module at startup are seperated from the module path by a space.
#
# Example:
#
#   broker_module= [moduleargs]
指定Nagios事件采集代理的模块库的路径,可以指定多个,后面可以跟上参数。

#broker_module=/somewhere/module1.o
#broker_module=/somewhere/module2.o arg1 arg2=3 debug=0
默认这里是空的。如果有强人找到定制模块或者自己开发的话就写在这边吧= =||

第十七部分:日志循环方式
# LOG ROTATION METHOD
# This is the log rotation method that Nagios should use to rotate
# the main log file. Values are as follows..
# n = None - don't rotate the log
# h = Hourly rotation (top of the hour)
# d = Daily rotation (midnight every day)
# w = Weekly rotation (midnight on Saturday evening)
# m = Monthly rotation (midnight last day of month)
指定Nagios用在写主日志记录时的循环记录方式。
值n表示none,不做循环。
值h表示hourly,每小时循环一次。(每小时的开始)
值d表示daily,每天循环一次。(每天的午夜)
值w表示weekly,每周循环一次。(每周六的晚上)
值m表示monthly,每月循环一次。(每上个月的最后一天的午夜)

log_rotation_method=d
设定主日志循环方式,默认是每天循环。

第十八部分:日志归档路径
# LOG ARCHIVE PATH
# This is the directory where archived (rotated) log files should be
# placed (assuming you've chosen to do log rotation).
这个路径将作为日志归档存放的地方(需要之前日志循环设定启用)

log_archive_path=/var/log/nagios/archives
设定日志归档路径。

第十九部分:加入系统日志选项
# LOGGING OPTIONS
# If you want messages logged to the syslog facility, as well as the
# NetAlarm log file set this option to 1.  If not, set it to 0.
选择是否将Nagios的运行信息加入系统的Syslog当中。值1表示加入,值0表示不加入。

use_syslog=1
默认设定Nagio信息加入系统日志。

第二十部分:通知消息记录选项
# NOTIFICATION LOGGING OPTION
# If you don't want notifications to be logged, set this value to 0.
# If notifications should be logged, set the value to 1.
如果不想记录通知消息的话,就设定该项为0值,相对的值1表示记录。

log_notifications=1
默认设定Nagios的通知信息是记录的。

第二十一部分:服务重启信息记录选项
# SERVICE RETRY LOGGING OPTION
# If you don't want service check retries to be logged, set this value
# to 0.  If retries should be logged, set the value to 1.
如果要记录服务重启信息,设定值1。不记录设定值0。

log_service_retries=1
默认设定记录服务重启信息。

第二十二部分:主机重启信息记录选项
# HOST RETRY LOGGING OPTION
# If you don't want host check retries to be logged, set this value to
# 0.  If retries should be logged, set the value to 1.
如果要记录主机重启信息,设定值1。不记录设定值0。

log_host_retries=1
默认设定记录主机重启信息。

第二十三部分:事件处理程序信息记录选项
# EVENT HANDLER LOGGING OPTION
# If you don't want host and service event handlers to be logged, set
# this value to 0.  If event handlers should be logged, set the value
# to 1.
如果要记录事件处理信息,设定值1。不记录设定值0。

log_event_handlers=1
默认启用记录事件处理程序信息。

第二十四部分:初始状态信息记录选项
# INITIAL STATES LOGGING OPTION
# If you want Nagios to log all initial host and service states to
# the main log file (the first time the service or host is checked)
# you can enable this option by setting this value to 1.  If you
# are not using an external application that does long term state
# statistics reporting, you do not need to enable this option.  In
# this case, set the value to 0.
如果想要Nagios记录所有初始化的主机和服务状态到主日志文件的话,那么请将这个配置项的值设定为1。不记录设定值0

log_initial_states=0
默认不记录初始化状态信息。

第二十五部分:外部命令信息记录选项。
# EXTERNAL COMMANDS LOGGING OPTION
# If you don't want Nagios to log external commands, set this value
# to 0.  If external commands should be logged, set this value to 1.
# Note: This option does not include logging of passive service
# checks - see the option below for controlling whether or not
# passive checks are logged.
如果想要Nagios记录外部命令信息的话,那么请将这个配置项的值设定为1,不记录设定值0。注意,这个选项将不包括被动服务的检查。

log_external_commands=1
默认设定记录外部命令信息。

第二十六部分:被动检查信息记录
# PASSIVE CHECKS LOGGING OPTION
# If you don't want Nagios to log passive host and service checks, set
# this value to 0.  If passive checks should be logged, set
# this value to 1.
如果想要Nagios记录被动主机和服务的检查信息的话,请设置为1,不记录设定为0。

log_passive_checks=1
默认设定记录被动检查信息。

第二十七部分:全局主机和服务的事件处理程序
# GLOBAL HOST AND SERVICE EVENT HANDLERS
# These options allow you to specify a host and service event handler
# command that is to be run for every host or service state change.
# The global event handler is executed immediately prior to the event
# handler that you have optionally specified in each host or
# service definition. The command argument is the short name of a
# command definition that you define in your host configuration file.
# Read the HTML docs for more information.
这些选项允许指定针对所有主机或服务状态变化运行的一个主机和服务事件处理程序命令。这个全局事件处理程序将比每一个主机上和服务上的定义要来的优先。命令的参数是在主机配置文件中,命令定义的简短名。

#global_host_event_handler=somecommand
#global_service_event_handler=somecommand
默认这里为空。

第二十八部分:服务间内部检查之间延时的方式
# SERVICE INTER-CHECK DELAY METHOD
# This is the method that Nagios should use when initially
# "spreading out" service checks when it starts monitoring.  The
# default is to use smart delay calculation, which will try to
# space all service checks out evenly to minimize CPU load.
# Using the dumb setting will cause all checks to be scheduled
# at the same time (with no delay between them)!  This is not a
# good thing for production, but is useful when testing the
# parallelization functionality.
# n = None - don't use any delay between checks
# d = Use a "dumb" delay of 1 second between checks
# s = Use "smart" inter-check delay calculation
#       x.xx    = Use an inter-check delay of x.xx seconds
这是Nagios启动初始化、对服务展开监控的时候使用的方式。默认情况下使用smart延时计算方式,它将尽力分隔开所有服务的检查,平衡地减少CPU届时的负载。如使用dump方式会造成所有检查作业在初始化时并发(这种方式下它们之间将没有时间延迟间隙)。
值n表示none,不做任何任何延迟。
值d表示dump,表示在两个相邻的检查之间做1秒钟的延迟。
值s表示smart,表示默认精简方式安排延迟。
值x.xx表示手动定制每相邻的检查之间固定的x.xx秒延迟。

service_inter_check_delay_method=s
默认设定服务间检查间隔采用smart算法。

第二十九部分:最大服务检查扩张
# MAXIMUM SERVICE CHECK SPREAD
# This variable determines the timeframe (in minutes) from the
# program start time that an initial check of all services should
# be completed.  Default is 30 minutes.
这个变量值决定了从程序开始时间起,对所有服务进行一次初始化检查完成的时间框架。默认是30分钟。

max_service_check_spread=30
默认最大服务检查扩张是30分钟。

第三十部分:服务交错检查因数
# SERVICE CHECK INTERLEAVE FACTOR
# This variable determines how service checks are interleaved.
# Interleaving the service checks allows for a more even
# distribution of service checks and reduced load on remote
# hosts.  Setting this value to 1 is equivalent to how versions
# of Nagios previous to 0.0.5 did service checks.  Set this
# value to s (smart) for automatic calculation of the interleave
# factor unless you have a specific reason to change it.
#       s       = Use "smart" interleave factor calculation
#       x       = Use an interleave factor of x, where x is a
#                 number greater than or equal to 1.
这个变量决定了服务检查之间是如何被交错检查的。交错的服务检查将更加离散化,并且减少远程主机的负载。设定值分为s,或者任何比1大的数字。

service_interleave_factor=s
默认下交错因数为s,即smart精简算法。

第三十一部分:主机间内部检查之间延时的方式
# HOST INTER-CHECK DELAY METHOD
# This is the method that Nagios should use when initially
# "spreading out" host checks when it starts monitoring.  The
# default is to use smart delay calculation, which will try to
# space all host checks out evenly to minimize CPU load.
# Using the dumb setting will cause all checks to be scheduled
# at the same time (with no delay between them)!
# n = None - don't use any delay between checks
# d = Use a "dumb" delay of 1 second between checks
# s = Use "smart" inter-check delay calculation
#       x.xx    = Use an inter-check delay of x.xx second
这是Nagios启动初始化、对主机展开监控的时候使用的方式。默认情况下使用smart延时计算方式,它将尽力分隔开所有主机的检查,平衡地减少CPU届时的负载。如使用dump方式会造成所有检查作业在初始化时并发(这种方式下它们之间将没有时间延迟间隙)。
值n表示none,不做任何任何延迟。
值d表示dump,表示在两个相邻的检查之间做1秒钟的延迟。
值s表示smart,表示默认精简方式安排延迟。
值x.xx表示手动定制每相邻的检查之间固定的x.xx秒延迟

host_inter_check_delay_method=s
默认设定主机间检查间隔是采用smart算法。

第三十二部分:最大主机检查扩张
# MAXIMUM HOST CHECK SPREAD
# This variable determines the timeframe (in minutes) from the
# program start time that an initial check of all hosts should
# be completed.  Default is 30 minutes.
这个变量值决定了从程序开始时间起,对所有主机进行一次初始化检查完成的时间框架。默认是30分钟。

max_host_check_spread=30
默认最大主机检查扩张是30分钟。

第三十三部分:最大并发服务检查
# MAXIMUM CONCURRENT SERVICE CHECKS
# This option allows you to specify the maximum number of
# service checks that can be run in parallel at any given time.
# Specifying a value of 1 for this variable essentially prevents
# any service checks from being parallelized.  A value of 0
# will not restrict the number of concurrent checks that are
# being executed.
这个选项将影响Nagios任一时刻间对服务检查的并发数量。设定值1的话会防止任何并发的服务检查。如果设定值0的话,每一时刻的服务检查并发数量将不严格按照当时实际执行的服务并发数量。

max_concurrent_checks=0
默认下这个参数设定是0。

第三十四部分:服务检查结果处理频率
# SERVICE CHECK REAPER FREQUENCY
# This is the frequency (in seconds!) that Nagios will process
# the results of services that have been checked.
这个值是Nagios将服务检查结果进行处理的频率。

service_reaper_frequency=10
默认这个频率值设定为10。

第三十五部分:检查结果缓冲区
# CHECK RESULT BUFFER SLOTS
# This settings is used to tweak the number of items or "slots" that
# the Nagios daemon should allocate to the buffer that holds
# service check results before they are processed.  As check results
# are processed by the daemon, they are removed from the buffer.  
这个缓冲区是Nagios守护进程对服务检查结果未处理前进行保留缓冲的大小。一旦这些结果被处理完毕之后就被立即清除出缓冲区。

check_result_buffer_slots=4096
默认这个检查结果的缓冲区是4MB。

第三十六部分:自动重调度选项
# AUTO-RESCHEDULING OPTION
# This option determines whether or not Nagios will attempt to
# automatically reschedule active host and service checks to
# "smooth" them out over time.  This can help balance the load on
# the monitoring server.  
# WARNING: THIS IS AN EXPERIMENTAL FEATURE - IT CAN DEGRADE
# PERFORMANCE, RATHER THAN INCREASE IT, IF USED IMPROPERLY
这个选项决定了Nagios是否将尝试自动去调度对活动主机和服务的检查,并使这些工作更平稳进行。这将对监视服务器的负载起到均衡帮助。警告:这个值的设定请慎重通过实验性能的测试,否则效果适得其反。

auto_reschedule_checks=0
默认下自动调度参数为0,关闭。

第三十七部分:自动重调度间隔
# AUTO-RESCHEDULING INTERVAL
# This option determines how often (in seconds) Nagios will
# attempt to automatically reschedule checks.  This option only
# has an effect if the auto_reschedule_checks option is enabled.
# Default is 30 seconds.
# WARNING: THIS IS AN EXPERIMENTAL FEATURE - IT CAN DEGRADE
# PERFORMANCE, RATHER THAN INCREASE IT, IF USED IMPROPERLY
这个选项决定了Nagios将多频繁地尝试自动重新调度检查工作,单位为秒。这个选项只有在AUTO-RESCHEULING OPTION选项启用时才有效。默认情况下是30秒。警告:这个值的设定请慎重通过实验性能的测试,否则效果适得其反。

auto_rescheduling_interval=30
默认下自动重调度间隔时间为30秒。

第三十八部分:自动重调度窗口大小
# AUTO-RESCHEDULING WINDOW
# This option determines the "window" of time (in seconds) that
# Nagios will look at when automatically rescheduling checks.
# Only host and service checks that occur in the next X seconds
# (determined by this variable) will be rescheduled. This option
# only has an effect if the auto_reschedule_checks option is
# enabled.  Default is 180 seconds (3 minutes).
# WARNING: THIS IS AN EXPERIMENTAL FEATURE - IT CAN DEGRADE
# PERFORMANCE, RATHER THAN INCREASE IT, IF USED IMPROPERLY
这个选项决定了Nagios一次尝试自动重新调度检查工作窗口的大小,单位为秒。只有在下一个X秒中内的主机和服务的检查会被重新调度(大小就是由这个值来决定)。同样,这个选项只有在AUTO-RESCHEULING OPTION选项启用时才有效。默认情况下是180秒。警告:这个值的设定请慎重通过实验性能的测试,否则效果适得其反。

auto_rescheduling_window=180
默认下自动重新调度窗口大小为180秒。

第三十九部分:休眠时间
# SLEEP TIME
# This is the number of seconds to sleep between checking for system
# events and service checks that need to be run.
这个以秒为单位的数值是在检查系统事件和服务检测之间的时间差值。

sleep_time=0.25
默认休眠时间是0.25秒。

第四十部分:超时数值
# TIMEOUT VALUES
# These options control how much time Nagios will allow various
# types of commands to execute before killing them off.  Options
# are available for controlling maximum time allotted for
# service checks, host checks, event handlers, notifications, the
# ocsp command, and performance data commands.  All values are in
# seconds.
这些选项控制着Nagios将能够多长时间允许那些不同类型命令在它们被终止以前保持执行。

service_check_timeout=60
host_check_timeout=30
event_handler_timeout=30
notification_timeout=30
ocsp_timeout=5
perfdata_timeout=5
  
第四十一部分:保持状态信息
# RETAIN STATE INFORMATION
# This setting determines whether or not Nagios will save state
# information for services and hosts before it shuts down.  Upon
# startup Nagios will reload all saved service and host state
# information before starting to monitor.  This is useful for
# maintaining long-term data on state statistics, etc, but will
# slow Nagios down a bit when it (re)starts.  Since its only
# a one-time penalty, I think its well worth the additional
# startup delay.
这个设定决定了Nagios是否在Nagios自己关闭前为服务和主机保存状态信息。紧接在Nagios启动之后,Nagios将在开始进行检测工作前重新载入之前保存的服务和主机的状态信息。这将对维护长期状态监测数据统计等工作有利。但是这个设定也会略微造成Nagios启动缓慢的效果。由于这种影响是一时性的,因此有开启的必要。

retain_state_information=1
默认保持状态信息功能是开启的。



第四十二部分:状态保留文件
# STATE RETENTION FILE
# This is the file that Nagios should use to store host and
# service state information before it shuts down.  The state
# information in this file is also read immediately prior to
# starting to monitor the network when Nagios is restarted.
# This file is used only if the preserve_state_information
# variable is set to 1.
这个文件将保留Nagios关闭前记录的主机和服务的状态信息。而这个文件也将是当Nagios再次启动后立即读取的文件。这个选项仅仅在保持状态信息功能开启时才有效。

state_retention_file=/var/log/nagios/retention.dat
设定状态保留文件路径。



第四十三部分:保留状态数据更新间隔
# RETENTION DATA UPDATE INTERVAL
# This setting determines how often (in minutes) that Nagios
# will automatically save retention data during normal operation.
# If you set this value to 0, Nagios will not save retention
# data at regular interval, but it will still save retention
# data before shutting down or restarting.  If you have disabled
# state retention, this option has no effect.
这个设定决定Nagios将多频繁地在正常工作过程中自动保存状态数据。如果设定值0的话,那么Nagios将在正常间隔中不保存数据,但是它仍然会在关闭或重启前对主机和服务状态做一次保存。如果关闭了保持状态信息功能的话,那么这个选项将无效。

retention_update_interval=60
默认保存状态数据间隔是60秒。



第四十四部分:使用保留程序状态
# USE RETAINED PROGRAM STATE
# This setting determines whether or not Nagios will set
# program status variables based on the values saved in the
# retention file.  If you want to use retained program status
# information, set this value to 1.  If not, set this value
# to 0.
这个设定决定了Nagios是否将程序的状态设定为基于上次保留的状态。如果使用保留的程序状态的话,那么设定值1,不启用则设定值0。

use_retained_program_state=1
默认是启用保留程序状态。



第四十五部分:使用保留调度信息
# USE RETAINED SCHEDULING INFO
# This setting determines whether or not Nagios will retain
# the scheduling info (next check time) for hosts and services
# based on the values saved in the retention file.  If you
# If you want to use retained scheduling info, set this
# value to 1.  If not, set this value to 0.
这个设定决定了Nagios是否保留将在下一个主机和服务的检测时间里使用上次保留的调度。如果启用保留调度信息的话设定值1,不启用为0。

use_retained_scheduling_info=0
默认不启用保留调度信息。



第四十六部分:间隔长度
# INTERVAL LENGTH
# This is the seconds per unit interval as used in the
# host/contact/service configuration files.  Setting this to 60 means
# that each interval is one minute long (60 seconds).  Other settings
# have not been tested much, so your mileage is likely to vary...
这是个以秒为单位,被用在主机/服务配置文件中。设定这个值为60意味着每个间隔将会是一分钟的长度。

interval_length=60
默认时间间隔长度是60秒。



第四十七部分:强行主机检测选项
# AGGRESSIVE HOST CHECKING OPTION
# If you don't want to turn on aggressive host checking features, set
# this value to 0 (the default).  Otherwise set this value to 1 to
# enable the aggressive check option.  Read the docs for more info
# on what aggressive host check is or check out the source code in
# base/checks.c
如果不想启用强行主机检测特性的话,设定该配置项值为0。否则设定该项值为1来启用强行主机检测选项。如果想更多了解关于强行主机检测功能的话请阅读base/checks.c的源代码或相关手册。

use_aggressive_host_checking=0
默认是不启用强制主机检测特性的。



第四十八部分:服务检测执行选项
# SERVICE CHECK EXECUTION OPTION
# This determines whether or not Nagios will actively execute
# service checks when it initially starts.  If this option is
# disabled, checks are not actively made, but Nagios can still
# receive and process passive check results that come in.  Unless
# you're implementing redundant hosts or have a special need for
# disabling the execution of service checks, leave this enabled!
# Values: 1 = enable checks, 0 = disable checks
这个设定决定了Nagios在启动初始的时候是否将主动地执行服务检测。如果这个选项被关闭了,监测将不会主动进行,但是Nagios会仍然接收和处理被动检测的结果。除非正在执行冗余主机或者有一个特殊的理由需要关闭服务检测的执行,否则应该让这个配置项保持启用。值1表示启用检测,值0表示关闭监测。

execute_service_checks=1
默认下服务检测是启用的。



第四十九部分:被动服务检测接受选项
# PASSIVE SERVICE CHECK ACCEPTANCE OPTION
# This determines whether or not Nagios will accept passive
# service checks results when it initially (re)starts.
# Values: 1 = accept passive checks, 0 = reject passive checks
这个设定决定了Nagios在启动或者重启时,是否将接受被动服务检测的结果。值1表示接受被动检测,值0表示拒绝被动检测。

accept_passive_service_checks=1
默认是启用被动服务检测功能的。



第五十部分:主机检测执行选项。
# HOST CHECK EXECUTION OPTION
# This determines whether or not Nagios will actively execute
# host checks when it initially starts.  If this option is
# disabled, checks are not actively made, but Nagios can still
# receive and process passive check results that come in.  Unless
# you're implementing redundant hosts or have a special need for
# disabling the execution of host checks, leave this enabled!
# Values: 1 = enable checks, 0 = disable checks
这个设定决定了Nagios在启动初始的时候是否将主动地执行主机检测。如果这个选项被关闭了,监测将不会主动进行,但是Nagios会仍然接收和处理被动检测的结果。除非正在执行冗余主机或者有一个特殊的理由需要关闭服务检测的执行,否则应该让这个配置项保持启用。值1表示启用检测,值0表示关闭监测。

execute_host_checks=1
默认下启用主机检测功能的。



第五十一部分:被动主机检测接受选项
# PASSIVE HOST CHECK ACCEPTANCE OPTION
# This determines whether or not Nagios will accept passive
# host checks results when it initially (re)starts.
# Values: 1 = accept passive checks, 0 = reject passive checks
这个设定决定了Nagios在启动或者重启时,是否将接受被动主机检测的结果。值1表示接受被动检测,值0表示拒绝被动检测。

accept_passive_host_checks=1
默认下是启用被动主机检测功能的。



第五十二部分:通知选项
# NOTIFICATIONS OPTION
# This determines whether or not Nagios will sent out any host or
# service notifications when it is initially (re)started.
# Values: 1 = enable notifications, 0 = disable notifications
这个设定将决定当Nagios启动或者重启时是否发送出任何主机或服务的通知。值1表示启用通知,值0表示关闭通知。

enable_notifications=1
默认是启用通知。



第五十三部分:事件处理程序使用选项
# EVENT HANDLER USE OPTION
# This determines whether or not Nagios will run any host or
# service event handlers when it is initially (re)started.  Unless
# you're implementing redundant hosts, leave this option enabled.
# Values: 1 = enable event handlers, 0 = disable event handlers
这个设定将决定当Nagios启动或者重启时是否运行任何主机或者服务的事件处理程序。除非在执行冗余主机或者有特殊的理由,否则请务必开启此功能。值1表示开启事件处理程序,值0表示关闭事件处理程序。

enable_event_handlers=1
默认启用事件处理程序。



第五十四部分:处理性能数据选项
# PROCESS PERFORMANCE DATA OPTION
# This determines whether or not Nagios will process performance
# data returned from service and host checks.  If this option is
# enabled, host performance data will be processed using the
# host_perfdata_command (defined below) and service performance
# data will be processed using the service_perfdata_command (also
# defined below).  Read the HTML docs for more information on
# performance data.
# Values: 1 = process performance data, 0 = do not process performance data
这个选项将决定Nagios是否处理从服务和主机检测当中返回的性能数据。如果这个选项被启用了,那么主机性能数据将通过host_perfdata_command中定义的方式进行处理,并且服务性能数据也将通过service_perfdata_command中定义的方式进行处理。设定值1表示处理性能数据,值0表示不处理性能数据。

process_performance_data=0
默认不对性能数据进行处理。



第五十五部分:主机和服务性能数据处理命令
# HOST AND SERVICE PERFORMANCE DATA PROCESSING COMMANDS
# These commands are run after every host and service check is
# performed.  These commands are executed only if the
# enable_performance_data option (above) is set to 1.  The command
# argument is the short name of a command definition that you
# define in your host configuration file.  Read the HTML docs for
# more information on performance data.
这些命令在每个主机和服务检测被执行的时候运行。这些命令仅仅当enable_performance_data选项置1的时候才会被执行。这个命令的参数则是在主机配置文件中定义的简写名。

#host_perfdata_command=process-host-perfdata
#service_perfdata_command=process-service-perfdata
默认这里是空的。



第五十六部分:主机和服务性能数据文件
# HOST AND SERVICE PERFORMANCE DATA FILES
# These files are used to store host and service performance data.
# Performance data is only written to these files if the
# enable_performance_data option (above) is set to 1.
这些文件被用来保存主机和服务性能的数据。如果enable_performance_data项设定值1的话,性能数据将能写入到这些文件当中。

#host_perfdata_file=/tmp/host-perfdata
#service_perfdata_file=/tmp/service-perfdata
默认注释掉性能数据文件的路径。



第五十七部分:主机和服务性能数据文件模版
# HOST AND SERVICE PERFORMANCE DATA FILE TEMPLATES
# These options determine what data is written (and how) to the
# performance data files.  The templates may contain macros, special
# characters (\t for tab, \r for carriage return, \n for newline)
# and plain text.  A newline is automatically added after each write
# to the performance data file.  Some examples of what you can do are
# shown below.
这些选项决定了数据文件当中将记录什么样的数据。模版可以包含宏、指定字符(\t表示tab,\r表示返回,\n表示换行)以及简单文本。换行则将被自动添加到每个写入的新的性能数据之后。以下则是示例的格式。

#host_perfdata_file_template=[HOSTPERFDATA]\t$TIMET$\t$HOSTNAME$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$
#service_perfdata_file_template=[SERVICEPERFDATA]\t$TIMET$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$


第五十八部分:主机和服务性能数据文件模式
# HOST AND SERVICE PERFORMANCE DATA FILE MODES
# This option determines whether or not the host and service
# performance data files are opened in write ("w") or append ("a")
# mode.  Unless you are the files are named pipes, you will probably
# want to use the default mode of append ("a").
这个选项将觉得主机和服务性能数据文件是否开放“写”(w)或“追加”(a)模式。除非你的文件通过管道来命名的,否则请使用默认的追加模式a。

#host_perfdata_file_mode=a
#service_perfdata_file_mode=a
默认这里是注释掉的。



第五十九部分:主机和服务性能数据文件处理间隔
# HOST AND SERVICE PERFORMANCE DATA FILE PROCESSING INTERVAL
# These options determine how often (in seconds) the host and service
# performance data files are processed using the commands defined
# below.  A value of 0 indicates the files should not be periodically
# processed.
这些选项决定了主机和服务性能数据文件将多频繁地通过下面定义的命令来处理。值0表示这些文件将不会被循环处理。

#host_perfdata_file_processing_interval=0
#service_perfdata_file_processing_interval=0
默认这里是注释掉的。



第六十部分:主机和服务性能数据文件处理命令
# HOST AND SERVICE PERFORMANCE DATA FILE PROCESSING COMMANDS
# These commands are used to periodically process the host and
# service performance data files.  The interval at which the
# processing occurs is determined by the options above.
这些命令被用来循环地处理主机和服务性能数据文件。而这些处理进行的时间的间隔将由上面的配置选项决定。

#host_perfdata_file_processing_command=process-host-perfdata-file
#service_perfdata_file_processing_command=process-service-perfdata-file
默认这里是注释掉的。



第六十一部分:迷惑服务检测选项?(这里不我也不是很明白)
# OBSESS OVER SERVICE CHECKS OPTION
# This determines whether or not Nagios will obsess over service
# checks and run the ocsp_command defined below.  Unless you're
# planning on implementing distributed monitoring, do not enable
# this option.  Read the HTML docs for more information on
# implementing distributed monitoring.
# Values: 1 = obsess over services, 0 = do not obsess (default)
这个选项将决定Nagios是否被服务检测迷惑并运行之后定义的ocsp_command。除非机会执行分布式的监测,否则不要轻易启用这个选项。值1表示迷惑服务。值0表示不迷惑服务。

obsess_over_services=0
默认不启用。



第六十二部分:OCSP命令
# OBSESSIVE COMPULSIVE SERVICE PROCESSOR COMMAND
# This is the command that is run for every service check that is
# processed by Nagios.  This command is executed only if the
# obsess_over_service option (above) is set to 1.  The command
# argument is the short name of a command definition that you
# define in your host configuration file. Read the HTML docs for
# more information on implementing distributed monitoring.
这是个由Nagios处理的、为每个服务检测而运行的命令。这个命令仅仅当obsess_over_service选项设定值1启动时才执行有效。这个命令的参数则是在主机配置文件中定义的简写名。

#ocsp_command=somecommand
默认这里配置为空。



第六十三部分:孤儿服务检测选项
# ORPHANED SERVICE CHECK OPTION
# This determines whether or not Nagios will periodically
# check for orphaned services.  Since service checks are not
# rescheduled until the results of their previous execution
# instance are processed, there exists a possibility that some
# checks may never get rescheduled.  This seems to be a rare
# problem and should not happen under normal circumstances.
# If you have problems with service checks never getting
# rescheduled, you might want to try enabling this option.
# Values: 1 = enable checks, 0 = disable checks
这个设定决定了Nagios是否会周期地检查被孤立的服务。因为服务检测在直到他们的上一个执行实例被处理前都不会被重新调度,所以就会有一个可能就是一些检测将会永远得不到重新调度。虽然这似乎会是一个比较罕见的问题,并且在正常情况下不会发生。如果你有这种某些服务检测永远得不到重调度的问题的话,可能需要将此选项置值为1启用。值0表示关闭。

check_for_orphaned_services=1
默认情况下是启用孤儿服务检测选项的。



第六十四部分:服务更新监测选项
# SERVICE FRESHNESS CHECK OPTION
# This option determines whether or not Nagios will periodically
# check the "freshness" of service results.  Enabling this option
# is useful for ensuring passive checks are received in a timely
# manner.
# Values: 1 = enabled freshness checking, 0 = disable freshness checking
这个选项将决定Nagios是否会周期性地检查服务更新结果。启用置1,不启用置0。

check_service_freshness=1
[co
2016-04-25 22:20 举报
已邀请:
0

先生好

赞同来自:

顶,收藏啊

回复帖子,请先登录注册

退出全屏模式 全屏模式 回复
评分
可选评分理由: