zabbix安裝配置agent程序之agent配置文件詳解


安裝zabbix-agent

http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/

下載:zabbix-agent-3.2.0-1.el6.x86_64.rpm

[root@check3 ~]# rpm -ivh zabbix-agent-3.2.0-1.el6.x86_64.rpm
[root@check3 ~]# cd /etc/zabbix/
[root@check3 zabbix]# mv zabbix_agentd.conf /tmp/
[root@check3 zabbix]# rpm -ivh /root/zabbix-agent-3.2.0-1.el6.x86_64.rpm

配置zabbix_agent

[root@check3 zabbix]# vim /etc/zabbix/zabbix_agentd.conf

# This is a configuration file for 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=/var/run/zabbix/zabbix_agentd.pid  #指定程序PID文件的路徑,可修改到其他路徑,但SNC不建議修改

### Option: LogType
#	Specifies where log messages are written to:
#	system - syslog
#	file - file specified with LogFile parameter
#	console - standard output
#
# Mandatory: no
# Default:
# LogType=file   #客戶端agent運行產生的日志文件路徑,可修改到其他路徑

### Option: LogFile
#	Log file name for LogType 'file' parameter.
#
# Mandatory: no
# Default:
# LogFile=

LogFile=/var/log/zabbix/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=0     #agent產生的日志大小控制,默認為1M,若為0,則表示不產生任何日志,數字范圍(1-1024)

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

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

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

### Option: LogRemoteCommands
#	Enable logging of executed shell commands as warnings.
#	0 - disabled  #不產生日志
#	1 - enabled   #產生日志
#
# Mandatory: no
# Default:
# LogRemoteCommands=0   #配置0/1 在執行遠程命令時是否保存日志,建議產生日志,以便日后查證

##### 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=127.0.0.1   #在有二級代理時,此處應填二級代理的IP,若沒有二級則此處填寫服務端IP

### Option: ListenPort
#	Agent will listen on this port for connections from the server.
#
# Mandatory: no
# Range: 1024-32767
# Default:
# ListenPort=10050  #此agent端以本地服務的形式運行,需要監聽端口,建議為10050,以便整個系統統一規划,也可以設置為1024-32768之間未使用的端口

### 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  #對應的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
# Default:
# StartAgents=3   #在被動模式下,此參數用於設置監聽進程可啟用的子進程的數量,若監控項較多且采集很頻繁,建議加大此值
#此值為0,則禁止使用被動模式,另外一般情況,不建議修改此值,且僅當某些監控項無法采集到數據,或數據采集有延遲現象時可調整,第四,啟用線程越多則多系統資源消耗越多
##### Active checks related

### 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=127.0.0.1  #在主動模式下,ServerActive為二級代理服務器或服務端的地址,默認端口10051,若需要更改端口則為IP:port

### 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=   #主機名,手工定義一個主機名,可以和系統的主機名一樣,也可以不一樣,此參數可根據實際情況啟用或關閉,建議關閉此參數啟用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   #自動獲取主機名,system.hostname是zabbix內置的一個自動獲取主機名的方法,為了方便配置,建議打開此參數而關閉Hostname參數,注意HostnameItem的優先級低於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
# Default:
# 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  #被監控的主機多久重新請求二級代理或服務端刷新監控列表,范圍為,60-3600秒,zabbix運行原理為,zabbix客戶端啟動后,在等待RefreshActiveChecks秒后,開始從二級代理服務端請求並下載監控信息,報錯在本地專門的buffersend中,再過RefreshActivceChecks秒后,重新獲取監控項信息,這就是為什么當配置監控項,要過一會才會生效的原因,這個數字就是等待時間,建議不要將此數字設置過小,以免加大agent端和服務端的壓力

### Option: BufferSend
#	Do not keep data longer than N seconds in buffer.
#
# Mandatory: no
# Range: 1-3600
# Default:
# BufferSend=5  #多少秒后將buffer中的數據提交到二級代理或服務端,范圍1-36600,此數字的大小決定了采集后,提交數據的及時性,數字越小,則提交的越頻繁,對服務器的壓力約大,同時對agent端服務器的資源消耗越大,則表現出來的是報警及時

### 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  #此參數作用設置保存采集數據在內存中的容量大小,若此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=20  #定義了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  #但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 the user specified by the User configuration option instead.
#	Has no effect if started under a regular user.
#	0 - do not allow
#	1 - allow
#
# Mandatory: no
# Default:
# AllowRoot=0 #是否允許root賬號允許此客戶端,0允許,1不允許,但一個腳本需要以root身份執行的時候此設置必須為0

### Option: User
#	Drop privileges to a specific, existing user on the system.
#	Only has effect if run as 'root' and AllowRoot is disabled.
#
# Mandatory: no
# Default:
# User=zabbix

### Option: Include
#	You may include individual files or all files in a directory in the configuration file.
#	Installing Zabbix will create include directory in /usr/local/etc, unless modified during the compile time.
#
# Mandatory: no
# Default:
# Include=   #從配置文件可管理性或擴展性考慮,若需要配置大量參數,且為了日后方便管理可以啟用此參數,建議根據實際情況,不過,一般情況下無需啟用

Include=/etc/zabbix/zabbix_agentd.d/*.conf

# Include=/usr/local/etc/zabbix_agentd.userparams.conf
# Include=/usr/local/etc/zabbix_agentd.conf.d/
# Include=/usr/local/etc/zabbix_agentd.conf.d/*.conf

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

### Option: UnsafeUserParameters
#	Allow all characters to be passed in arguments to user-defined parameters.
#	The following characters are not allowed:
#	\ ' " ` * ? [ ] { } ~ $ ! & ; ( ) < > | # @
#	Additionally, newline characters are not allowed.
#	0 - do not allow
#	1 - allow
#
# Mandatory: no
# Range: 0-1
# Default:
# UnsafeUserParameters=0   #是否啟用自定義監控腳本,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=  #用戶自定義腳本,當UnsafeUserParamenters=1時UserParamenter生效,以下為SNC初始自定義監控腳本,不建議,已有選項,但可自定義添加

####### 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的開發

####### TLS-RELATED PARAMETERS #######

### Option: TLSConnect
#	How the agent should connect to server or proxy. Used for active checks.
#	Only one value can be specified:
#	unencrypted - connect without encryption
#	psk - connect using TLS and a pre-shared key
#	cert - connect using TLS and a certificate
#
# Mandatory: yes, if TLS certificate or PSK parameters are defined (even for 'unencrypted' connection)
# Default:
# TLSConnect=unencrypted

### Option: TLSAccept
#	What incoming connections to accept.
#	Multiple values can be specified, separated by comma:
#	unencrypted - accept connections without encryption
#	psk - accept connections secured with TLS and a pre-shared key
#	cert - accept connections secured with TLS and a certificate
#
# Mandatory: yes, if TLS certificate or PSK parameters are defined (even for 'unencrypted' connection)
# Default:
# TLSAccept=unencrypted

### Option: TLSCAFile
#	Full pathname of a file containing the top-level CA(s) certificates for
#	peer certificate verification.
#
# Mandatory: no
# Default:
# TLSCAFile=

### Option: TLSCRLFile
#	Full pathname of a file containing revoked certificates.
#
# Mandatory: no
# Default:
# TLSCRLFile=

### Option: TLSServerCertIssuer
# Allowed server certificate issuer.
#
# Mandatory: no
# Default:
# TLSServerCertIssuer=

### Option: TLSServerCertSubject
# Allowed server certificate subject.
#
# Mandatory: no
# Default:
# TLSServerCertSubject=

### Option: TLSCertFile
#	Full pathname of a file containing the agent certificate or certificate chain.
#
# Mandatory: no
# Default:
# TLSCertFile=

### Option: TLSKeyFile
#	Full pathname of a file containing the agent private key.
#
# Mandatory: no
# Default:
# TLSKeyFile=

### Option: TLSPSKIdentity
#	Unique, case sensitive string used to identify the pre-shared key.
#
# Mandatory: no
# Default:
# TLSPSKIdentity=

### Option: TLSPSKFile
#	Full pathname of a file containing the pre-shared key.
#
# Mandatory: no
# Default:
# TLSPSKFile=

zabbix分布式監控系統安裝配置:http://www.cnblogs.com/LuckWJL/p/9037007.html

安裝配置zabbix代理之zabbix_proxyhttp://www.cnblogs.com/LuckWJL/p/9055587.html

zabbix_server通過zabbix_proxy進行監控Hosthttp://www.cnblogs.com/LuckWJL/p/9056195.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM