Nagios 配置文件解析(1)


Nagios配置文件在Nagios安装和配置时显得尤为重要,让我们来具体的看看他的内容!

Nagios 

图-Nagios

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

  1. # NAGIOS.CFG - Sample Main Config File for Nagios 3.0.6  
  2.  
  3. # Read the documentation for more information on this configuration  
  4.  
  5. # file. I've provided some comments here, but things may not be so  
  6.  
  7. # clear without further explanation.  
  8.  
  9. # Last Modified: 10-15-2008  
  10.  

# LOG FILE

  1. # This is the main log file where service and host events are logged  
  2.  
  3. for historical purposes. This should be the first option specified  
  4.  
  5. in the config file!!!  
  6.  

# 这个变量用于设定Nagios在何处创建其日志文件。

# 它应该是你主配置文件里面的第一个变量,当Nagios找到你配置文件并发现配置里有错误时会向该文件中写入错误信息。

# 如果你使能了日志回滚,Nagios将在每小时、每天、每周或每月对日志进行回滚。

log_file=/usr/local/nagios/var/nagios.log

# OBJECT CONFIGURATION FILE(S)

# 对象的配置文件

  1. # These are the object configuration files in which you define hosts,  
  2.  
  3. # host groups, contacts, contact groups, services, etc.  
  4.  
  5. # You can split your object definitions across several config files  
  6.  
  7. if you wish (as shown below), or keep them all in a single config file.  
  8.  

# 该变量用于指定一个包含有将用于Nagios监控对象的对象配置文件。

# 对象配置文件中包括有主机、主机组、联系人、联系人组、服务、命令等等对象的定义。

# 配置信息可以切分为多个文件并且用cfg_file=语句来指向每个待处理的配置文件

# You can specify individual object config files as shown below:

# 您可以指定单个对象的配置文件, 如下所示:

  1. cfg_file=/usr/local/nagios/etc/objects/commands.cfg  
  2.  
  3. cfg_file=/usr/local/nagios/etc/objects/contacts.cfg  
  4.  
  5. cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg  
  6.  
  7. cfg_file=/usr/local/nagios/etc/objects/templates.cfg  
  8.  
  9. # Definitions for monitoring the local (Linux) host  
  10.  

# 定义监测本地( Linux )主机

  1. cfg_file=/usr/local/nagios/etc/objects/localhost.cfg  
  2.  
  3. # Definitions for monitoring a Windows machine  
  4.  

# 定义监测( windows )主机

  1. #cfg_file=/usr/local/nagios/etc/objects/windows.cfg  
  2.  
  3. # Definitions for monitoring a router/switch 
  4.  

# 定义监测路由器或交换机

  1. #cfg_file=/usr/local/nagios/etc/objects/switch.cfg  
  2.  
  3. # Definitions for monitoring a network printer  
  4.  


相关内容