zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    “数学题”——传钱
    kafka笔记——入门介绍
    SpringBoot集成Dubbo+Zookeeper
    MySql基本语法
    动态规划
    总结
    Java反射
    软件清单
    Java IO操作
    Spring Boot AOP的使用
  • 原文地址:https://www.cnblogs.com/chuyiwang/p/9055912.html
Copyright © 2011-2022 走看看