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 