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