Zabbix Agent配置文件詳解

參考自http://blog.51cto.com/lookingdream/1839558

# This is a config file for the Zabbix agent daemon (Unix)
# To get more information about Zabbix, visit http://www.zabbix.com

############ GENERAL PARAMETERS #################

### Option: PidFile
#   Name of PID file.
#
# Mandatory: no
# Default:
# PidFile=/tmp/zabbix_agentd.pid
# PidFile=PID路徑
# 說明:指定程程序PIDFILE路徑,可修改到其它路徑,但SNC不建議修改

PidFile=/var/run/zabbix/zabbix_agentd.pid

### Option: LogFile
#   Name of log file.
#   If not set, syslog is used.
#
# Mandatory: no
# Default:
# LogFile=
# LogFile=路徑
# 說明:客戶端AGENT運行產生的日誌文件路徑,可修改到其它路徑,如/var/log/zabbix_agnetd.log,視具體情況修改,也可保持默認

LogFile=/var/log/zabbix-agent/zabbix_agentd.log

### Option: LogFileSize
#   Maximum size of log file in MB.
#   0 - disable automatic log rotation.
#
# Mandatory: no
# Range: 0-1024
# Default:
# LogFileSize=1
# LogFileSize=數字
# 說明:AGENT產生日誌大小控制,默認1M,若爲0,則表示不產生任何日誌,數字範圍(1-1024M)不建議關閉日誌功能,建議保持默認

LogFileSize=0

### Option: DebugLevel
#   Specifies debug level
#   0 - no debug 無日誌級別
#   1 - critical information 災難信息級別
#   2 - error information 一般錯誤信息級別
#   3 - warnings 警告級別
#   4 - for debugging (produces lots of information) 調試級別
# 說明:0~4級別,日誌產生量在相同單位時間,生成的日誌量爲遞增,即0級別日誌量最少,4級別最多,默認3級別,建議視具體情況,自行把握
#
# Mandatory: no
# Range: 0-4
# Default:
# DebugLevel=3

### Option: SourceIP
#   Source IP address for outgoing connections.
#
# Mandatory: no
# Default:
# SourceIP=
# SourceIP=IP地址
# 說明:當系統設置有多個IP時,需要指定一個IP與二級代理或服務端通信,若系統只有一個IP,也建議指定一個IP

### Option: EnableRemoteCommands
#   Whether remote commands from Zabbix server are allowed.
#   0 - not allowed
#   1 - allowed
#
# Mandatory: no
# Default:
# EnableRemoteCommands=0
# EnableRemoteCommands=0或1
# 說明:是否允許在本地執行遠程命令,建議設置爲“允許”,因爲SNC對命令下發功能進行了二次開發,功能強大,極大的方便日誌運維工作

### Option: LogRemoteCommands
#   Enable logging of executed shell commands as warnings.
#   0 - disabled 不產生日誌
#   1 - enabled 產生日誌
#
# Mandatory: no
# Default:
# LogRemoteCommands=0
# LogRemoteCommands=1或0
# 說明:在參數EnableRemoteCommands=1的情況下,執行遠程命令是否保存操作日誌,若已設置EnableRemoteCommands=1
# 建議LogRemoteCommands=1,以便日後查證。若EnableRemoteCommands=0,此參數不生效

##### Passive checks related
# 與被動模式有關的參數設置
# 什麼是被動模式?
# 被動模式下,由二級代理或服務端主動請求AGENT,去獲取所採集到的監控數據

### Option: Server
#   List of comma delimited IP addresses (or hostnames) of Zabbix servers.
#   Incoming connections will be accepted only from the hosts listed here.
#   If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally.
#
# Mandatory: no
# Default:
# Server=
# Server=IP地址或主機名,建議IP地址
# 說明:在有二級代理情況下,此IP地址應該填寫二級代理服務器的IP,反之,若無二級代理服務器,則此IP應設置爲服務端IP

Server=127.0.0.1

### Option: ListenPort
#   Agent will listen on this port for connections from the server.
#
# Mandatory: no
# Range: 1024-32767 (監控端口範圍)
# Default:
# ListenPort=10050
# ListenPort=數字
# 說明:此AGENT端以本地服務的形式運行,需要監聽端口,強烈建議設置爲10050,以便移動整個系統統一規劃管理,當然,特殊情況下可修改爲1024-32767 未使用的端口

### Option: ListenIP
#   List of comma delimited IP addresses that the agent should listen on.
#   First IP address is sent to Zabbix server if connecting to it to retrieve list of active checks.
#
# Mandatory: no
# Default:
# ListenIP=0.0.0.0
# ListenIP=IP地址
# 說明:對應的ListenPort監聽到哪個IP上面,建議指定IP時,不用0.0.0.0

### Option: StartAgents
#   Number of pre-forked instances of zabbix_agentd that process passive checks.
#   If set to 0, disables passive checks and the agent will not listen on any TCP port.
#
# Mandatory: no
# Range: 0-100 數字範圍(0-100)
# Default:
# StartAgents=3
# StartAgents=數字
# 說明:在被動模式下,此參數用於設置控制監聽進程可啓用的子進程的數量,若監控項較多且採集很頻繁,建議加大此數值;
# 若此數值爲0,則禁止使用被動模式。另外,一般情況,不建議修改此數值,當且僅當某些監控項無法採集到數據,或數據採集數據有延遲現象時,可調整。第四,啓用線程越多,則相對越耗系統資源

##### Active checks related
# 主動模式相關參數設置
# 什麼時主動模式?
# 在主動模式下,AGENT端(即採集客戶端)將所採集的結果,主動提交給二級代理服務器或服務器,而此種情況下,二級代理服務器或服務器將被動接收採集信息

### Option: ServerActive
#   List of comma delimited IP:port (or hostname:port) pairs of Zabbix servers for active checks.
#   If port is not specified, default port is used.
#   IPv6 addresses must be enclosed in square brackets if port for that host is specified.
#   If port is not specified, square brackets for IPv6 addresses are optional.
#   If this parameter is not specified, active checks are disabled.
#   Example: ServerActive=127.0.0.1:20051,zabbix.domain,[::1]:30051,::1,[12fc::1]
#
# Mandatory: no
# Default:
# ServerActive=
# ServerActive=IP地址或IP地址:端口號
# 說明:在主動模式下,ServerActive爲二級代理服務器或服務器,默認端口爲10051,若需更改端口,則爲#ServerActive=IP:port,非特殊情況下,不建議修改。

ServerActive=127.0.0.1

### Option: Hostname
#   Unique, case sensitive hostname.
#   Required for active checks and must match hostname as configured on the server.
#   Value is acquired from HostnameItem if undefined.
#
# Mandatory: no
# Default:
# Hostname=
# Hostname=主機名
# 說明:手工自定義一個主機名,可以和系統的主機名一樣,也可以不一樣,此參數可根據實際情況啓用或關閉,建議關閉此參數,並啓用HostnameItem參數

Hostname=Zabbix server

### Option: HostnameItem
#   Item used for generating Hostname if it is undefined. Ignored if Hostname is defined.
#   Does not support UserParameters or aliases.
#
# Mandatory: no
# Default:
# HostnameItem=system.hostname
# HostnameItem:自動獲取主機名
# 說明:system.hostname是ZABBIX內置的一個自動獲取主機名的方法,爲了方便配置,建議打開此參數而關閉Hostname參數#。注意:HostnameItem的優化級低於Hostname,當兩個參數都啓用且配置的情況下,ZABBIX獲取的主機名,將以Hostname爲#準

### Option: HostMetadata
#   Optional parameter that defines host metadata.
#   Host metadata is used at host auto-registration process.
#   An agent will issue an error and not start if the value is over limit of 255 characters.
#   If not defined, value will be acquired from HostMetadataItem.
#
# Mandatory: no
# Range: 0-255 characters 0-255個字符
# Default:
# HostMetadata=
# HostMetadata=字符串
# 說明:用於定義當前主機唯一標識符,最大長度255個,僅適用於自動發現情況下,默認不定義,建議不定義

### Option: HostMetadataItem
#   Optional parameter that defines an item used for getting host metadata.
#   Host metadata is used at host auto-registration process.
#   During an auto-registration request an agent will log a warning message if
#   the value returned by specified item is over limit of 255 characters.
#   This option is only used when HostMetadata is not defined.
#
# Mandatory: no
# Default:
# HostMetadataItem=
# 說明;用於獲取主機的HostMetadata,建議保持默認

### Option: RefreshActiveChecks
#   How often list of active checks is refreshed, in seconds.
#
# Mandatory: no
# Range: 60-3600
# Default:
# RefreshActiveChecks=120
# RefreshActiveChecks=數字
# 說明:被監控的主機多久(秒)重新請求二級代理或服務端刷新一監控列表。範圍爲60-3600秒。ZABBIX運行原理爲:,zabbix客戶端啓動後,在等待RefreshActiveChecks秒後,開始從二級代理或服務端請求並下載監控項信息,保存在本地專門的buffersend中,再過RefreshActiveChecks秒後,重新獲取監控項信息。這就是爲什麼當配置監控項,要過一會才能生效的原因。這個數值,就是等待時間。建議,不要將此數值設置過小,以免加大AGENT端和服務端及數據庫的壓力,建議爲120秒。

### Option: BufferSend
#   Do not keep data longer than N seconds in buffer.
#
# Mandatory: no
# Range: 1-3600
# Default:
# BufferSend=5
# BufferSend=數字
# 說明:多少秒後,將BUFFER中的數據提交到二級代理或服務端。範圍(1-36600)此數值的大小決定了採集後,提交數據的及時性,數值越小,則提交得越頻繁,對服務器壓力越大,同時對AGENT端系統資源消耗越大,則表現出來的現象是報警非常及時,建議根據實際情況自行考慮,也可保持默認,若發現ZABBIX消耗資源較多,建議加大此數值。

### Option: BufferSize
#   Maximum number of values in a memory buffer. The agent will send
#   all collected data to Zabbix Server or Proxy if the buffer is full.
#
# Mandatory: no
# Range: 2-65535
# Default:
# BufferSize=100
# BufferSize=數值
# 說明:此參數作用設置保存採集數據在內存中的容量大小。若此agent端監控項較多,建議加大此數值。BufferSize與BufferSend之間有聯繫的。當達到bUFFERSEND或Buffersize已滿時,都會觸發數據提交動作。

### Option: MaxLinesPerSecond
#   Maximum number of new lines the agent will send per second to Zabbix Server
#   or Proxy processing 'log' and 'logrt' active checks.
#   The provided value will be overridden by the parameter 'maxlines',
#   provided in 'log' or 'logrt' item keys.
#
# Mandatory: no
# Range: 1-1000
# Default:
# MaxLinesPerSecond=100
# MaxLinesPerSecond=數值
# 說明:定義了AGENT在1秒內發送的日誌行數,用於避免網絡或cpu過載,建議保持默認

############ ADVANCED PARAMETERS #################
# 高級參數設置

### Option: Alias
#   Sets an alias for an item key. It can be used to substitute long and complex item key with a smaller and simpler one.
#   Multiple Alias parameters may be present. Multiple parameters with the same Alias key are not allowed.
#   Different Alias keys may reference the same item key.
#   For example, to retrieve the ID of user 'zabbix':
#   Alias=zabbix.userid:vfs.file.regexp[/etc/passwd,^zabbix:.:([0-9]+),,,,\1]
#   Now shorthand key zabbix.userid may be used to retrieve data.
#   Aliases can be used in HostMetadataItem but not in HostnameItem parameters.
#
# Mandatory: no
# Range:
# Default:
# 設置參數的別名。它可以替代長和複雜的一個小而簡單的一個有用的參數名稱

### Option: Timeout
#   Spend no more than Timeout seconds on processing
#
# Mandatory: no
# Range: 1-30
# Default:
# Timeout=3
# Timeout=數值
# 說明:當agent採集一個數據時,多長少算超時。建議保持默認

### Option: AllowRoot
#   Allow the agent to run as 'root'. If disabled and the agent is started by 'root', the agent
#   will try to switch to user 'zabbix' instead. Has no effect if started under a regular user.
#   0 - do not allow
#   1 - allow
#
# Mandatory: no
# Default:
# AllowRoot=0
# AllowRoot=0或1
# 說明:是否允許ROOT帳號運行此客戶端。0:不允許,1:允許,當一個腳本執行需要以ROOT身份執行的,則此開關必須打開,建議根據實際情況開啓或關閉,

### Option: Include
#   You may include individual files or all files in a directory in the configuration file.
#   Installing Zabbix will create include directory in /etc/zabbix, unless modified during the compile time.
#
# Mandatory: no
# Default:
# Include=
# Include=目錄路徑或擴展配置文件路徑
# 說明:從配置文件可管理性或擴展性考慮,若需配置大量參數的且爲了方便後續管理可以啓用此參數,建議根據實際情況考慮,不過,一般情況下無須啓用
# Include=/etc/zabbix/zabbix_agentd.userparams.conf
# Include=/etc/zabbix/zabbix_agentd.conf.d/
Include=/etc/zabbix/zabbix_agentd.conf.d/

####### USER-DEFINED MONITORED PARAMETERS #######
# 自定義監控腳本

### Option: UnsafeUserParameters
#   Allow all characters to be passed in arguments to user-defined parameters.
#   0 - do not allow
#   1 - allow
#
# Mandatory: no
# Range: 0-1
# Default:
# UnsafeUserParameters=0
# UnsafeUserParameters=0或1
# 說明:是否啓用用戶自定義監控腳本,1啓用,0不啓用。由於ZABBIX實現監控方法的多樣性,一般都採用腳本來實現監控數據的採集,所以,建議開啓,否則功能將受限。

### Option: UserParameter
#   User-defined parameter to monitor. There can be several user-defined parameters.
#   Format: UserParameter=<key>,<shell command>
#   See 'zabbix_agentd' directory for examples.
#
# Mandatory: no
# Default:
# UserParameter=

####### LOADABLE MODULES #######

### Option: LoadModulePath
#   Full path to location of agent modules.
#   Default depends on compilation options.
#
# Mandatory: no
# Default:
# LoadModulePath=${libdir}/modules
# 說明:擴展模塊路徑,強烈建議不要改動,除非你具有AGENT 開發能力

### Option: LoadModule
#   Module to load at agent startup. Modules are used to extend functionality of the agent.
#   Format: LoadModule=<module.so>
#   The modules must be located in directory specified by LoadModulePath.
#   It is allowed to include multiple LoadModule parameters.
#
# Mandatory: no
# Default:
# LoadModule=
# 說明:擴展模塊路徑,強烈建議不要改動,除非你具有AGENT 開發能力



# UserParameter=
# 說明:用戶自定義監控腳本,當且僅當UnsafeUserParameters=1時UserParameter生效。以下爲SNC初始自定監控腳本,不建議修改,已有選項,但可自義添加。
# 自定義監控項配置語法
# UserParameter=key,command
# 如何使用:以獲取mysql監控爲例
# 步驟1,設置自定義腳本
# UserParameter=mysql.questions,mysqladmin -uroot --password='XXXXX' status|cut -f4 -d":"|cut -f1 -d"S"
# 保存退出,並重啓AGENT
# 步驟2,手工驗證
# 在二級代理端或服務器端用命令 zabbix_get -s IP -k mysql.questions 將返回採集信息
# 步驟3,在管理頁面添加監控項
# 注意:成功關鍵,腳本本身具有可執行權限,且腳本運行正常

UserParameter=cmd[*],$1 $2 $3 $4 $5 $6 $7 $8 $9
UserParameter=setenv[*],java -jar /smp/sncmon/java/setenv/setenv.jar $1 $2
UserParameter=oracle[*],java -jar /smp/sncmon/java/oracle/oracle.jar $1 /smp/sncmon/java/oracle/
UserParameter=db2[*],/smp/sncmon/java/db2/linux.sh $1
UserParameter=mindwaresctipt,setsid /smp/sncmon/shell/middleware/middle_zabbix.sh
UserParameter=agent.restart,/smp/sncmon/shell/agent/agentrestart.sh
UserParameter=diskmon,/smp/sncmon/shell/diskmon/disk_mon.sh $1
發佈了45 篇原創文章 · 獲贊 61 · 訪問量 7萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章