阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Zabbix Server参数文件详解

151次阅读
没有评论

共计 12762 个字符,预计需要花费 32 分钟才能阅读完成。

Zabbix 的配置文件一般有三种:

  • zabbix_server.conf:zabbix server 的配置文件
  • zabbix_proxy.conf:zabbix proxy 的配置文件
  • zabbix_agentd.conf:zabbix agentd 的配置文件

Zabbix 安装完成后,服务端默认的配置文件存在安装文件夹中的 etc 目录中,假设编译的参数是“–prefix=/usr/local/zabbix”,那么服务端的配置文件则保存在“/usr/loca/zabbix/etc/”目录下。zabbix_server.conf 参数除了保证服务正常运行外,还会影响服务器的性能。如果参数设定不合理可能会导致 zabbix 添加主机不正常、代理端数据无法正常收集或是 zabbix 服务器性能严重下降,经常报告 CPU 占用过高或是 IO 占用过高等问题。本文说明了 zabbix server 的配置文件中的通用参数和大部分高级参数的具体用法,内容如下:

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

### Option: ListenPort
#       Listen port for trapper. 
// 该参数用于指定服务端的监听端口,用于监听 Proxy 或 Agent 的连接请求。#
# Mandatory: no
# Range: 1024-32767
# Default:
# ListenPort=10051

### Option: SourceIP
#       Source IP address for outgoing connections.
// 该参数用于指定服务端的 IP 地址。#
# Mandatory: no
# Default:
# SourceIP=

### Option: LogType
#       Specifies where log messages are written to://zabbix 的日志类型
#               system  - syslog // 写入到系统日志
#               file    - file specified with LogFile parameter // 写入到指定文件
#               console - standard output // 写入到标准输出
#
# Mandatory: no
# Default:
# LogType=file

### Option: LogFile
#       Log file name for LogType 'file' parameter.
// 日志文件的存储路径
#
# Mandatory: no
# Default:
# LogFile=

LogFile=/tmp/zabbix_server.log

### Option: LogFileSize
#       Maximum size of log file in MB.
#       0 - disable automatic log rotation.
// 指定日志文件的大小,单位 MB。0 表示禁用日志轮转
#
# Mandatory: no
# Range: 0-1024
# Default:
# LogFileSize=1

### Option: DebugLevel
#       Specifies debug level: // 指定 debug 级别
#       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) 
#
# Mandatory: no
# Range: 0-5
# Default:
# DebugLevel=3

### Option: PidFile
#       Name of PID file.
//pid 文件名
#
# Mandatory: no
# Default:
# PidFile=/tmp/zabbix_server.pid

### Option: DBHost
#       Database host name.
#       If set to localhost, socket is used for MySQL.
#       If set to empty string, socket is used for PostgreSQL.
// 数据库主机名,如果设置为 localhost,mysql 必须用 socket 来连接,否则用 ip 来连接。若该参数为空,默认连接 PostgreSQL
#
# Mandatory: no
# Default:
# DBHost=localhost


### Option: DBName
#       Database name.
#       For SQLite3 path to database file must be provided. DBUser and DBPassword are ignored.
// 数据库名。对 SQLite3 来说,必须提供数据文件的路径,DBUser 和 DBPassword 参数可忽略
#
# Mandatory: yes
# Default:
# DBName=

### Option: DBSchema
#       Schema name. Used for IBM DB2 and PostgreSQL.
// 模式名。用于 DB2 或 PostgreSQL 数据库
#
# Mandatory: no
# Default:
# DBSchema=

### Option: DBUser
#       Database user. Ignored for SQLite.
// 连接数据库的用户名,SQLite 忽略该参数
#
# Mandatory: no
# Default:
# DBUser=

### Option: DBPassword
#       Database password. Ignored for SQLite.
#       Comment this line if no password is used.
// 连接数据库的密码,SQLite 忽略该参数
#
# Mandatory: no
# Default:
# DBPassword=

### Option: DBSocket
#       Path to MySQL socket.
//socket 文件的路径
#
# Mandatory: no
# Default:
# DBSocket=/tmp/mysql.sock

### Option: DBPort
#       Database port when not using local socket. Ignored for SQLite.
// 数据库监听端口,SQLite 忽略该参数
#
# Mandatory: no
# Range: 1024-65535
# Default (for MySQL):
# DBPort=3306

############ ADVANCED PARAMETERS ################

### Option: StartPollers
#       Number of pre-forked instances of pollers.
// 系统初始化时,预分配子进程数量。数量越多,则服务端吞吐能力越强,对系统资源消耗越大。#
# Mandatory: no
# Range: 0-1000
# Default:
# StartPollers=5

### Option: StartIPMIPollers
#       Number of pre-forked instances of IPMI pollers.
// 系统初始化时,预分配的使用 ipmi 协议获取主机硬件状态的进程数量。#
# Mandatory: no
# Range: 0-1000
# Default:
# StartIPMIPollers=0

### Option: StartPollersUnreachable
#       Number of pre-forked instances of pollers for unreachable hosts (including IPMI and Java).
#       At least one poller for unreachable hosts must be running if regular, IPMI or Java pollers
#       are started.
// 系统初始化时,预分配用于探测某些不可达主机的(含 IPMI、JAVA)的进程数量;若使用场景中含有代理端,建议保持默认;若 Agent 较多,可视具体情况调整。#
# Mandatory: no
# Range: 0-1000
# Default:
# StartPollersUnreachable=1

### Option: StartTrappers
#       Number of pre-forked instances of trappers.
#       Trappers accept incoming connections from Zabbix sender, active agents and active proxies.
#       At least one trapper process must be running to display server availability and view queue
#       in the frontend. 
// 系统初始化时,预分配的用于接收 zabbix sender 提交来数据的进程。#
# Mandatory: no
# Range: 0-1000
# Default:
# StartTrappers=5

### Option: StartPingers
#       Number of pre-forked instances of ICMP pingers. 
// 系统初始化时,预分配的 icmp ping 进程的数量。若单台代理所管理机器超过 500 台,建议加大此数值
#
# Mandatory: no
# Range: 0-1000
# Default:
# StartPingers=1

### Option: StartDiscoverers
#       Number of pre-forked instances of discoverers. 
// 系统初始化时,预分配的自动发现主机的线程数量。若单台代理所管理机器超过 500 台,可以考虑加大此数值(仅适用于 AGENT 场景)#
# Mandatory: no
# Range: 0-250
# Default:
# StartDiscoverers=1

### Option: StartHTTPPollers
#       Number of pre-forked instances of HTTP pollers. 
// 系统预分配的用于设置 WEB 监控进程数,可视具体情况增加或减少此数值。#
# Mandatory: no
# Range: 0-1000
# Default:
# StartHTTPPollers=1

### Option: StartTimers
#       Number of pre-forked instances of timers. 
#       Timers process time-based trigger functions and maintenance periods.
#       Only the first timer process handles the maintenance periods.
// 各实例计时器数量
#
# Mandatory: no
# Range: 1-1000
# Default:
# StartTimers=1

### Option: StartEscalators
#       Number of pre-forked instances of escalators.
#
# Mandatory: no
# Range: 0-100
# Default:
# StartEscalators=1

### Option: StartVMwareCollectors
#       Number of pre-forked vmware collector instances. 
// 用于监控 VMWARE Esxi 主机实例的进程数量,为 0 则不启用,若要监控 ESXI 主机,此值最少为 1;视监控 ESXI 数量设置对应数值
#
# Mandatory: no
# Range: 0-250
# Default:
# StartVMwareCollectors=0

### Option: VMwareFrequency
#       How often Zabbix will connect to VMware service to obtain a new data. 
//Zabbix 连接 WMware service 获取新数据的频率
#
# Mandatory: no
# Range: 10-86400
# Default:
# VMwareFrequency=60

### Option: VMwarePerfFrequency
#       How often Zabbix will connect to VMware service to obtain performance data.
#
# Mandatory: no
# Range: 10-86400
# Default:
# VMwarePerfFrequency=60

### Option: VMwareCacheSize
#       Size of VMware cache, in bytes.  
#       Shared memory size for storing VMware data.
#       Only used if VMware collectors are started.
// 用于缓存 VMware 数据的共享内存
#
# Mandatory: no
# Range: 256K-2G
# Default:
# VMwareCacheSize=8M

### Option: VMwareTimeout
#       Specifies how many seconds vmware collector waits for response from VMware service.
#
# Mandatory: no
# Range: 1-300
# Default:
# VMwareTimeout=10

### Option: SNMPTrapperFile
#       Temporary file used for passing data from SNMP trap daemon to the server.
#       Must be the same as in zabbix_trap_receiver.pl or SNMPTT configuration file.
#
# Mandatory: no
# Default:
# SNMPTrapperFile=/tmp/zabbix_traps.tmp

### Option: StartSNMPTrapper
#       If 1, SNMP trapper process is started.
// 是否启用 snmptrapper 功能,默认不启用 =0,启用 =1
#
# Mandatory: no
# Range: 0-1
# Default:
# StartSNMPTrapper=0

### Option: ListenIP
#       List of comma delimited IP addresses that the trapper should listen on.
#       Trapper will listen on all network interfaces if this parameter is missing.
#
# Mandatory: no
# Default:
# ListenIP=0.0.0.0
# ListenIP=127.0.0.1

### Option: HousekeepingFrequency
#       How often Zabbix will perform housekeeping procedure (in hours).
#       Housekeeping is removing outdated information from the database.
#       To prevent Housekeeper from being overloaded, no more than 4 times HousekeepingFrequency
#       hours of outdated information are deleted in one housekeeping cycle, for each item.
#       To lower load on server startup housekeeping is postponed for 30 minutes after server start.
#       With HousekeepingFrequency=0 the housekeeper can be only executed using the runtime control option.
#       In this case the period of outdated information deleted in one housekeeping cycle is 4 times the
#       period since the last housekeeping cycle, but not less than 4 hours and not greater than 4 days. 
// 多少小时清理一次数据库的 history, alert, and alarms 数据
#
# Mandatory: no
# Range: 0-24
# Default:
# HousekeepingFrequency=1

### Option: MaxHousekeeperDelete
#       The table "housekeeper" contains "tasks" for housekeeping procedure in the format:
#       [housekeeperid], [tablename], [field], [value].
#       No more than 'MaxHousekeeperDelete' rows (corresponding to [tablename], [field], [value])
#       will be deleted per one task in one housekeeping cycle.
#       SQLite3 does not use this parameter, deletes all corresponding rows without a limit.
#       If set to 0 then no limit is used at all. In this case you must know what you are doing!
//housekeeping 一次删除的数据不能大于 MaxHousekeeperDelete
#
# Mandatory: no
# Range: 0-1000000
# Default:
# MaxHousekeeperDelete=5000

### Option: SenderFrequency
#       How often Zabbix will try to send unsent alerts (in seconds).
// 指定间隔多少秒后,再尝试发送为发送的报警
#
# Mandatory: no
# Range: 5-3600
# Default:
# SenderFrequency=30

### Option: CacheSize
#       Size of configuration cache, in bytes.
#       Shared memory size for storing host, item and trigger data. 
// 分配多少共享内存用于存储配置信息,HOST,ITEM,TRIGGER 数据,视监控主机数量和监控项调整,建议调整到 32M 或者更大,2.2.3 版本之前最大支持 2G,��前最大支持 8G,一般用不了多少。#
# Mandatory: no
# Range: 128K-8G
# Default:
# CacheSize=8M

### Option: CacheUpdateFrequency
#       How often Zabbix will perform update of configuration cache, in seconds. 
// 更新系统 CACHE 频率,若管理页面操作不频繁,可以考虑加大参数值
#
# Mandatory: no
# Range: 1-3600
# Default:
# CacheUpdateFrequency=60

### Option: StartDBSyncers
#       Number of pre-forked instances of DB Syncers. 
// 将采集数据从 CACHE 同步到数据库线程数量,视数据库服务器 I / O 繁忙情况,和数据库写能力调整。数值越大,写能力越强。对数据库服务器 I / O 压力越大。#
# Mandatory: no
# Range: 1-100
# Default:
# StartDBSyncers=4

### Option: HistoryCacheSize
#       Size of history cache, in bytes.
#       Shared memory size for storing history data. 
// 设置划分多少共享内存用于存储采集的历史数据,此数值越大,数据库读压力越小
#
# Mandatory: no
# Range: 128K-2G
# Default:
# HistoryCacheSize=16M

### Option: HistoryIndexCacheSize
#       Size of history index cache, in bytes.
#       Shared memory size for indexing history cache. 
// 历史数据索引缓存
#
# Mandatory: no
# Range: 128K-2G
# Default:
# HistoryIndexCacheSize=4M

### Option: TrendCacheSize
#       Size of trend cache, in bytes.
#       Shared memory size for storing trends data. 
// 用于设置划分多少共享内存用于存储计算出来的趋势数据,此参数值从一定程度上可影响数据库读压力
#
# Mandatory: no
# Range: 128K-2G
# Default:
# TrendCacheSize=4M

### Option: ValueCacheSize
#       Size of history value cache, in bytes.
#       Shared memory size for caching item history data requests.
#       Setting to 0 disables value cache.
// 0 表示禁用,history value 缓存大小,当缓存超标了,将会每隔 5 分钟往 server 日志里面记录。#
# Mandatory: no
# Range: 0,128K-64G
# Default:
# ValueCacheSize=8M

### Option: Timeout
#       Specifies how long we wait for agent, SNMP device or external check (in seconds). 
// 与 AGNET、SNMP 设备和其它外部设备通信超时设置,单位为秒;若采集数据不完整或网络繁忙,或从管理页面发现客户端状态变化频繁,可以考虑加大此数值。注意若此数值加大,应该考虑参数 StartPollers 是否有相应加大的必要。#
# Mandatory: no
# Range: 1-30
# Default:
# Timeout=3

### Option: TrapperTimeout
#       Specifies how many seconds trapper may spend processing new data. 
// 启用 trapper 功能,用于进程等待超时设置。#
# Mandatory: no
# Range: 1-300
# Default:
# TrapperTimeout=300

### Option: UnreachablePeriod
#       After how many seconds of unreachability treat a host as unavailable.
// 当 Agent 端处于不可用状态下,间隔多少秒后,尝试重新连接。建议根据具体情况设置。注意,若此数值过小,若 Agent 端业务系统繁忙时,有可能造成报警误报
#
# Mandatory: no
# Range: 1-3600
# Default:
# UnreachablePeriod=45

### Option: UnavailableDelay
#       How often host is checked for availability during the unavailability period, in seconds. 
// 当 Agent 端处于不可用状态下,间隔多少秒后,进行状态检查。若出现可正常采集数据,但管理页面 AGENT 状态不正常、或在网络,端口等均通畅情况下,AGENT 状态仍不正常,可以考虑加大此数值
#
# Mandatory: no
# Range: 1-3600
# Default:
# UnavailableDelay=60

### Option: UnreachableDelay
#       How often host is checked for availability during the unreachability period, in seconds.
// 当 Agent 端处于不可达状态下,延迟多少秒后,进行重新尝试,建议保持默认,在 AGENT 接入调试阶段,可考虑减少此数值
#
# Mandatory: no
# Range: 1-3600
# Default:
# UnreachableDelay=15

### Option: AlertScriptsPath
#       Full path to location of custom alert scripts. 
#       Default depends on compilation options.
// 自定义告警脚本存放全路径
#
# Mandatory: no
# Default:
# AlertScriptsPath=${datadir}/zabbix/alertscripts

### Option: LogSlowQueries
#       How long a database query may take before being logged (in milliseconds).
#       Only works if DebugLevel set to 3, 4 or 5.
#       0 - don't log slow queries. 
// 用于服务端数据库慢查询功能,单位是毫秒。若有服务端数据库监控慢查询的需求,可以视具体情况调整此数。#
# Mandatory: no
# Range: 1-3600000
# Default:
# LogSlowQueries=0

### Option: TmpDir
#       Temporary directory.
// 指定临时目录路径
#
# Mandatory: no
# Default:
# TmpDir=/tmp

### Option: StartProxyPollers
#       Number of pre-forked instances of pollers for passive proxies.
// 启用多少子进程与代理端通信,若代理端较多可考虑加大此数值
#
# Mandatory: no
# Range: 0-250
# Default:
# StartProxyPollers=1

### Option: ProxyConfigFrequency
#       How often Zabbix Server sends configuration data to a Zabbix Proxy in seconds.
#       This parameter is used only for proxies in the passive mode.
//Zabbix 服务端将配置文件数据同步到代理端的频率,仅适用于代理端为被动模式情况
#
# Mandatory: no
# Range: 1-3600*24*7
# Default:
# ProxyConfigFrequency=3600

### Option: ProxyDataFrequency
#       How often Zabbix Server requests history data from a Zabbix Proxy in seconds.
#       This parameter is used only for proxies in the passive mode.
//Zabbix 服务端请求代理端采集的数据的频率,仅适用代理端为被动模式情况
#
# Mandatory: no
# Range: 1-3600
# Default:
# ProxyDataFrequency=1

### Option: AllowRoot 
#       Allow the server to run as 'root'. If disabled and the server is started by 'root', the server
#       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
// 是否允许以 root 身份运行服务端
#
# Mandatory: no
# Default:
# AllowRoot=0

### Option: User
#       Drop privileges to a specific, existing user on the system.
#       Only has effect if run as 'root' and AllowRoot is disabled.
// 启动 zabbix server 的用户,在配置禁止 root 启动,并且当前 shell 用户是 root 得情况下有效。如果当前用户是 abc,那么 zabbix server 的运行用户是 abc
#
# 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.
// 某些情况下,软件的参数配置文件很长,为了方便管理,将配置文件切割成 N 个配置文件,但为了主配置参数文件的简洁,便会启用 INCLUDE 参数,以方便程序读取指定目录下的所有配置文件
#
# Mandatory: no
# Default:
# Include=

# Include=/usr/local/etc/zabbix_server.general.conf
# Include=/usr/local/etc/zabbix_server.conf.d/
# Include=/usr/local/etc/zabbix_server.conf.d/*.conf

一些 Zabbix 相关教程集合

Ubuntu 14.04 下 Zabbix2.4.5 源码编译安装  http://www.linuxidc.com/Linux/2015-05/117657.htm

安装部署分布式监控系统 Zabbix 2.06 http://www.linuxidc.com/Linux/2013-07/86942.htm

《安装部署分布式监控系统 Zabbix 2.06》http://www.linuxidc.com/Linux/2013-07/86942.htm

CentOS 6.3 下 Zabbix 安装部署 http://www.linuxidc.com/Linux/2013-05/83786.htm

Zabbix 分布式监控系统实践 http://www.linuxidc.com/Linux/2013-06/85758.htm

CentOS 6.3 下 Zabbix 监控 apache server-status http://www.linuxidc.com/Linux/2013-05/84740.htm

CentOS 6.3 下 Zabbix 监控 MySQL 数据库参数 http://www.linuxidc.com/Linux/2013-05/84800.htm

64 位 CentOS 6.2 下安装 Zabbix 2.0.6   http://www.linuxidc.com/Linux/2014-11/109541.htm

ZABBIX 的详细介绍:请点这里
ZABBIX 的下载地址:请点这里

本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-07/133242.htm

正文完
星哥说事-微信公众号
post-qrcode
 
星锅
版权声明:本站原创文章,由 星锅 2022-01-21发表,共计12762字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中