目录
[5.Zabbix 架构](#5.Zabbix 架构)
[7.Zabbix 术语](#7.Zabbix 术语)
[二. 部署安装zabbix](#二. 部署安装zabbix)
[三.zabbix 配置文件](#三.zabbix 配置文件)
一.Zabbix简介
1.为什么需要监控
运维行业有句话:"无监控、不运维",监控俗称"第三只眼"。没了监控,什么基础运维,业务运维都是"瞎子"。所以说监控是运维这个职业的根本。尤其是在现在有人说运维是背锅侠,那么,有了监控,有了充足的数据,一切以数据说话,运维还需要背锅吗,所以作为一个运维工程师,如何构建一套监控系统是你的第一件工作。
监控功能
-
在需要的时刻,提前预警即将出问题,避免故障发生
-
实时监控系统和业务,当出问题之后,通过发出告警,提醒相关人员,快速可以找到问题的根源,从而及时处理问题
-
可以实现网站,应用或者服务器的故障自愈, 保证高可用性
-
以图形或易观察的方式呈现当前以及过往的状态,便于分析和预测系统发展趋势
2.需要监控什么
监控一切需要监控的资源,包括:服务器,网络设备,业务应用,云服务等
分类 | 实例内容 |
---|---|
硬件监控 | 通过远程控制卡: DeLL的iDRAC,HP的ILO和IBM的IMM等 使用IPMI来完成物理设备的监控工作。通常必须要监控包括温度、硬盘故障等 路由器,交换机(端口,光衰,日志),打印机等 |
系统监控 | cpu,内存,硬盘使用率,硬盘IO,系统负载,进程数 |
服务监控 | nginx,apache, php-fpm,mysql.memcache,redis ,tomcat,JVM,TCP连接数 |
性能监控 | 网站性能,服务器性能,数据库性能,存储性能 |
日志监控 | 系统会产生系统日志,应用程序会有应用的访问日志、错误日志,服务有运行日志等, 可以使用ELK来进行日志监控 |
安全监控 | 用户登录数,passwd文件变化,本地所有文件改动 Nginx+Lua编写一个WAF通过kibana可以图形化的展示不同的攻击类型的统计。 |
网络监控 | IP,端口,URL,DB,ping包,IDC带宽网络流量,网络流出速率,网络入流量, 网络出流是.网络使用率,SMTP.POP3 |
3.常见的监控工具
开源监控软件:cacti、nagios、zabbix、smokeping、open-falcon等
4.Zabbix使用场景及系统概述
Zabbix是一个企业级解决方案,支持实时监控数千台服务器,虚拟机和网络设备,采集百万级监控指标,适用于任何IT基础架构、服务、应用程序和资源的解决方案
Zabbix功能
Zabbix 是一个高度成熟完善的网络监控解决方案,包含了多种功能
官方链接:
历史数据, 即记录每个监控项采集到的每个监控值
趋势数据, 主要保留某个监控项一个小时内历史数据的最大值、最小值和平均值以及该监控项一个小时内所采集到的数据个数
可用性和性能检查;
支持 SNMP(包括主动轮询和被动捕获)、IPMI、JMX、VMware 监控;
自定义检查;
按照自定义的时间间隔采集需要的数据;
通过 Server/Proxy 和 Agents 来执行数据采集。
灵活的阈值定义
您可以参考后端数据库定义非常灵活的告警阈值,即触发器
高度可配置化的告警
可以根据递增计划、接收者、媒介类型自定义发送告警通知;
使用宏变量可以使告警通知变得更加高效有用;
自动操作包含远程执行命令。
实时图形
使用内置图形功能可以将监控项实时绘制成图形。
web 监控功能
Zabbix可以追踪模拟鼠标在 Web 网站上的点击操作,来检查 Web 网站的功能和响应时间。
丰富的可视化选项
可以组合多个监控项到单个视图中,创建自定义图表;
网络拓扑图;
以仪表盘样式展示自定义聚合图形和幻灯片演示;
报表;
监控资源的更高层次展示视图(业务视图)。
历史数据存储
存储在数据库中的数据;
历史配置;内置数据管理机制
配置简单
将被监控设备添加为主机;
主机一旦添加到数据库中,就会采集数据用于监控;
将模板用于监控设备。
使用模板
模板中分组检查;
模板可以关联模板,继承已关联模板的属性。
网络发现
自动发现网络设备;
Zabbix Agent 发现设备后自动注册;
自动发现文件系统、网络接口
快捷的WEB界面
基于 PHP 的 Web 前端;
可以从任何地方访问;
您可以定制自己的操作方式;
您可以通过审计日志来查看你的操作
Zabbix API
Zabbix API 为 Zabbix 提供可编程接口,用于批量操作、第三方软件集成和其他用途
权限管理系统
安全的用户身份验证;
指定的用户只能查看指定的权限范围内的视图
功能强大且易于扩展的Zabbix Agent
部署于被监控对象上;
支持 Linux 和 Windows ;
二进制守护进程
为了更好的性能和更少的内存占用,采用 C 语言编写;
便于移植。
适应更复杂的环境
使用 Zabbix Proxy 代理,可以轻松实现分布式远程监控
5.Zabbix 架构
SERVER
Zabbix server 是 Zabbix 软件的核心组件
Zabbix Agent 向其报告可用性、系统完整性信息和统计信息。
Zabbix server也是存储所有配置信息、统计信息和操作信息的核心存储库。
Zabbix server也是Zabbix监控系统的告警中心。在监控的系统中出现任何异常,将发出通知给管理员。
基本的 Zabbix Server 的功能分解成为三个不同的组件。他们是:Zabbix server、Web前端和数据库。
tips:
Zabbix 的所有配置信息都存储在 Server和Web前端进行交互的数据库中。例如,当你通过Web前端(或者API)新增一个监控项时,它会被添加到数据库的监控项表里。然后,Zabbix server 以每分钟一次的频率查询监控项表中的有效项,接着将它存储在 Zabbix server 中的缓存里。这就是为什么 Zabbix前端所做的任何更改需要花费两分钟左右才能显示在最新的数据段的原因。
数据库
所有配置信息以及 Zabbix 采集到的数据都被持久存储在数据库中
可以支持MySQL,PostgreSQL,Oracle 等多种数据库
WEB 界面
WEB 界面是 Zabbix server 的一部分,用于实现展示和配置的界面通常(但不一定)和 Zabbix server 运行在同一台物理机器上基于 Apache(Nginx)+PHP 实现,早期只支持LAMP架构,从Zabbix5.0开始支持LNMP
AGENT
Zabbix agents 部署在被监控目标上,用于主动监控本地资源和应用程序,并将收集的数据发送给Zabbix server。从Zabbix5.0开始支技Zabbix Agent2
PROXY
Zabbix Proxy 可以代替 Zabbix Server 采集性能和可用性数据
Zabbix Proxy 在 Zabbix 的部署是可选部分
Zabbix Proxy 的部署可以很好的分担单个Zabbix server的负载
Java 网关
Zabbix 要监控 tomcat 服务器和其它JAVA程序,需要使用 Java gateway 做为代理,才能从JAVA程序中获取数据
6.Zabbix工作流程
-
数据收集:
Zabbix Agent 或者其他监控方式(如SNMP、JMX等)从被监控设备或系统中收集数据。
数据可以是系统性能(CPU、内存、磁盘使用率等)、服务运行状态、网络流量等。 -
数据处理:
Zabbix Server 或 Proxy 接收并处理来自 Agent 或其他监控方式的数据。
数据处理包括存储历史数据、触发器状态的计算、生成报警事件等。 -
数据存储:
监控数据、历史记录和配置信息存储在后端数据库中,如 MySQL、PostgreSQL 等。
-
监控和管理:
管理员通过 Zabbix Web Interface 进行监控配置、管理和报告查看。
可以设置监控项、触发器、报警方式和通知规则。 -
报警和通知:
当触发器状态满足报警条件时,Zabbix Server 生成报警事件。
报警可以通过多种方式通知管理员或运维人员,如电子邮件、短信、Slack 等。
7.Zabbix 术语
-
被监控主机 (Host):
被监控主机是指通过 Zabbix 进行监控的设备或系统,可以是服务器、网络设备、虚拟机等。
-
监控项 (Item):
监控项定义了需要收集的具体数据,如 CPU 利用率、内存使用率、服务状态等。每个监控项对应一个具体的数据指标。
-
应用集 (Application):
应用集用于组织和管理相关的监控项,方便用户根据功能或类型对监控项进行分类和查看。
-
触发器 (Trigger):
触发器定义了一个条件表达式,用于判断监控项数据是否达到需要关注的状态。当条件满足时,触发器会触发一个或多个动作。
-
动作 (Action):
动作定义了在触发器条件满足时需要执行的操作,比如发送通知、执行脚本等。动作是实现告警和响应的关键机制之一。
-
告警 (Alarm):
告警是触发器和动作组合起来的结果,用于通知管理员或相关人员某个监控事件已发生或某个指标已超过阈值。
-
Web 监测:
Web 监测是指对 Web 服务的监控,可以检查网站的可用性、响应时间、状态码等,确保服务的稳定性和可靠性。
-
模板 (Template):
模板是预定义的监控配置集合,包含一组监控项、应用集、触发器、图形等。可以将模板应用到多个主机上,实现监控配置的复用和统一管理。
items(监控项)
applications(应用集)
triggers(触发器)
graphs(图形)
screens (聚合图形,自Zabbix 2.0起)
二. 部署安装zabbix
1.编译安装zabbix
1.1 解决依赖关系
bash
yum install gcc libxml2-devel net-snmp net-snmp-devel curl curl-devel php php-bcmath php-mbstring mariadb mariadb-devel libevent-devel java-1.8.0-openjdk-devel -y
1.2 建立管理用户
bash
groupadd zabbix
useradd -g zabbix zabbix
1.3 加压包
bash
cd /opt
#切换目录
将下载好的zabbix-4.0.30.tar.gz包拖入/opt目录下
#下载安装包
tar xf zabbix-4.0.30.tar.gz
#解压
1.4 编译安装
bash
cd zabbix-4.0.30
./configure --help
#可以查看帮助
./configure --prefix=/apps/zabbix_server --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 --enable-java
make
make install
2.添加客户端
bash
./configure --prefix=/apps/zabbix --enable-agent
在别的机器上 客户机需要安装的 客户端
- 安装数据库
数据库可以安装在本地也可以分离
bash
yum install mariadb-server.x86_64 -y
systemctl start mariadb
mysql_secure_installation 安全加固脚本
mysql -uroot -p
create database zabbix character set utf8 collate utf8_bin;
#创建数据库命令
create user zabbix@localhost identified by 'zabbix';
#创建用户命令
grant all privileges on zabbix.* to zabbix@localhost;
#授予权限
set global log_bin_trust_function_creators = 1;
设置全局变量
quit;
4.导入 zabbix 数据库文件
bash
cd /opt/zabbix-4.0.30/database/mysql
mysql -uzabbix -pzabbix zabbix < schema.sql
mysql -uzabbix -pzabbix zabbix < images.sql
mysql -uzabbix -pzabbix zabbix < data.sql
###必须最后 导入 data.sql
5.安装web apache
bash
yum install httpd -y
systemctl start httpd
cd /opt/zabbix-4.0.30/frontends/php/
cp -a . /var/www/html/zabbix/
# 将前端页面拷贝过去
- 修改zabbix配置
bash
vim /apps/zabbix_server/etc/zabbix_server.conf
# grep "^[a-Z]" /apps/zabbix_server/etc/zabbix_server.conf
LogFile=/tmp/zabbix_server.log
DBName=zabbix_server
DBUser=zabbix
DBPassword=zabbix
LogSlowQueries=3000
118 行修改 下 密码 其他不用修改
118 DBPassword= zabbix
#启动 zabbixserver 和 zabbixagented
/apps/zabbix_server/sbin/zabbix_server
/apps/zabbix_server/sbin/zabbix_agentd
打开浏览器 访问 192.168.240.13/zabbix
7.升级php版本
bash
yum install php-gettext php-xml php-net-socket php-gd php-mysql -y
修改php 软件的配置
vim /etc/php.ini
384 max_execution_time = 300
394max_input_time = 600
672 post_max_size = 16M
878 date.timezone = Asia/Shanghai
#改完 以后
systemctl restart httpd
默认用户名:Admin 密码: zabbix
8.准备service文件
bash
#先停止 zabbix-server
pkill zabbix_server
vim /usr/lib/systemd/system/zabbix-server.service
[Unit]
Description=Zabbix Server
After=syslog.target
After=network.target
[Service]
Environment="CONFFILE=/apps/zabbix_server/etc/zabbix_server.conf"
EnvironmentFile=-/etc/default/zabbix-server
Type=forking
Restart=on-failure
PIDFile=/tmp/zabbix_server.pid
KillMode=control-group
ExecStart=/apps/zabbix_server/sbin/zabbix_server -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
TimeoutSec=infinity
[Install]
WantedBy=multi-user.target
chown zabbix:zabbix /apps/zabbix_server/ -R
systemctl daemon-reload
systemctl start zabbix-server.service
systemctl status zabbix-server.service
#先停止当前zabbix_agent进程 10050端口
pkill zabbix_agentd
vim /usr/lib/systemd/system/zabbix-agent.service
[Unit]
Description=Zabbix Agent
After=syslog.target
After=network.target
[Service]
Environment="CONFFILE=apps/zabbix_server/etc/zabbix_agentd.conf"
EnvironmentFile=-/etc/default/zabbix-agent
Type=forking
Restart=on-failure
PIDFile=/tmp/zabbix_agentd.pid
KillMode=control-group
ExecStart=/apps/zabbix_server/sbin/zabbix_agentd -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
User=zabbix
Group=zabbix
[Install]
WantedBy=multi-user.target
systemctl restart zabbix-agent && systemctl enable zabbix-agent
9.修改中文
下面是乱码
去win主机的c盘
C:\Windows\Fonts
bash
# pwd
/var/www/html/zabbix/assets/fonts #上传楷体字体文件到这里
# chown zabbix.zabbix ./* #更改权限为zabbix用户和组
# ll
总用量 12260
drwxr-xr-x 2 zabbix zabbix 4096 12月 14 11:28 ./
drwxr-xr-x 5 zabbix zabbix 4096 11月 25 17:06 ../
-rw-r--r-- 1 zabbix zabbix 756072 11月 25 17:05 DejaVuSans.ttf
-rw-r--r-- 1 root root 11787328 3月 2 2019 simkai.ttf
#后缀必须小写 ttf
# pwd
/var/www/html/zabbix
# vim include/defines.inc.php
#72 define('ZBX_GRAPH_FONT_NAME', 'DejaVuSans'); // font file name
72 define('ZBX_GRAPH_FONT_NAME', 'SIMHEI'); // font file name
#113 define('ZBX_FONT_NAME', 'DejaVuSans');
113 define('ZBX_FONT_NAME', 'SIMHEI');
[root@localhost zabbix]# cd /var/www/html/zabbix/assets/fonts
[root@localhost fonts]# ls
DejaVuSans.ttf SIMHEI.TTF
[root@localhost fonts]# mv SIMHEI.TTF SIMHEI.ttf
三.zabbix 配置文件
官方源安装:
服务端 配置文件位置 : /etc/zabbix/zabbix_server.conf
agent 配置文件位置: /etc/zabbix/zabbix_agentd.conf
cs
# cat /:apps/zabbix_server/etc/zabbix_server.conf
# This is a configuration file for Zabbix server daemon
# To get more information about Zabbix, visit http://www.zabbix.com
############ GENERAL PARAMETERS #################
### Option: ListenPort
# Listen port for trapper.
#
# Mandatory: no
# Range: 1024-32767
# Default:
ListenPort=10051 #监听端口
### Option: SourceIP
# Source IP address for outgoing connections.
#
# Mandatory: no
# Default:
# SourceIP= #多IP地址情况下,与其他服务器通信使用的源IP地址
### 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 #日志类型,支持system、file和console
### Option: LogFile
# Log file name for LogType 'file' parameter.
#
# Mandatory: yes, if LogType is set to file, otherwise no
# Default:
# LogFile=
LogFile=/tmp/zabbix_server.log #日志路径
### Option: LogFileSize
# Maximum size of log file in MB.
# 0 - disable automatic log rotation.
#
# Mandatory: no
# Range: 0-1024
# Default:
# LogFileSize=1 #指定日志滚动写入大小,当达到指定大小时,会删除就日志重新从头写入新日志
### 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)
#
# Mandatory: no
# Range: 0-5
# Default:
# DebugLevel=3 #自定义日志级别
### Option: PidFile
# Name of PID file.
#
# Mandatory: no
# Default:
# PidFile=/tmp/zabbix_server.pid #PID文件路径
### Option: SocketDir
# IPC socket directory.
# Directory to store IPC sockets used by internal Zabbix services.
#
# Mandatory: no
# Default:
# SocketDir=/tmp #socket文件路径
### Option: DBHost
# Database host name.
# If set to localhost, socket is used for MySQL.
# If set to empty string, socket is used for PostgreSQL.
#
# Mandatory: no
# Default:
DBHost=192.168.7.104 #数据库地址
### Option: DBName
# Database name.
#
# Mandatory: yes
# Default:
# DBName=
DBName=zabbix_server #数据库名称
### Option: DBSchema
# Schema name. Used for IBM DB2 and PostgreSQL.
#
# Mandatory: no
# Default:
# DBSchema= #数据库访问协议
### Option: DBUser
# Database user.
#
# Mandatory: no
# Default:
# DBUser=
DBUser=zabbix #数据库用户名称
### Option: DBPassword
# Database password.
# Comment this line if no password is used.
#
# Mandatory: no
# Default:
DBPassword=123456 #数据库用户密码
### Option: DBSocket
# Path to MySQL socket.
#
# Mandatory: no
# Default:
# DBSocket= #数据库socket文件
### Option: DBPort
# Database port when not using local socket.
#
# Mandatory: no
# Range: 1024-65535
# Default:
DBPort=3306 #数据库端口
### Option: HistoryStorageURL
# History storage HTTP[S] URL.
#
# Mandatory: no
# Default:
# HistoryStorageURL= #elasticsearch服务器地址,保存zabbix历史数据到ES里面,优化zabbix性能,新版本zabbix的才支持
### Option: HistoryStorageTypes
# Comma separated list of value types to be sent to the history storage.
#
# Mandatory: no
# Default:
# HistoryStorageTypes=uint,dbl,str,log,text #elasticsearch索引类型
### Option: HistoryStorageDateIndex
# Enable preprocessing of history values in history storage to store values in different indices based on date.
# 0 - disable
# 1 - enable
#
# Mandatory: no
# Default:
# HistoryStorageDateIndex=0 #将历史数据保存到不同的elasticsearch索引
### Option: ExportDir
# Directory for real time export of events, history and trends in newline delimited JSON format.
# If set, enables real time export.
#
# Mandatory: no
# Default:
# ExportDir= #定义实时导出触发器事件,监控项采集值,趋势数据的目录
### Option: ExportFileSize
# Maximum size per export file in bytes.
# Only used for rotation if ExportDir is set.
#
# Mandatory: no
# Range: 1M-1G
# Default:
# ExportFileSize=1G #定义每个导出文件的最大大小
############ 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.
# The IPMI manager process is automatically started when at least one IPMI poller is started.
#
# Mandatory: no
# Range: 0-1000
# Default:
# StartIPMIPollers=0 #IPMI收集数量
### Option: StartPreprocessors
# Number of pre-forked instances of preprocessing workers.
# The preprocessing manager process is automatically started when preprocessor worker is started.
#
# Mandatory: no
# Range: 1-1000
# Default:
# StartPreprocessors=3 #预启动多少个进程用于处理zabbix agent数据
### 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.
#
# 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.
#
# Mandatory: no
# Range: 0-1000
# Default:
# StartTrappers=5 #预启动的Trappers进程数据
### Option: StartPingers
# Number of pre-forked instances of ICMP pingers.
#
# Mandatory: no
# Range: 0-1000
# Default:
# StartPingers=1 #ICMP ping进程的初始实例数量
### Option: StartDiscoverers
# Number of pre-forked instances of discoverers.
#
# Mandatory: no
# Range: 0-250
# Default:
# StartDiscoverers=1 #自动发现主机的进程数量
### Option: StartHTTPPollers
# Number of pre-forked instances of HTTP pollers.
#
# Mandatory: no
# Range: 0-1000
# Default:
# StartHTTPPollers=1 #http 进程数量
### Option: StartTimers
# Number of pre-forked instances of timers.
# Timers process maintenance periods.
# Only the first timer process handles host maintenance updates. Problem suppression updates are shared
# between all timers.
#
# 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 #escalators进程的初始实例数量,用于处理动作中的自动步骤的进程的数量
### Option: StartAlerters
# Number of pre-forked instances of alerters.
# Alerters send the notifications created by action operations.
#
# Mandatory: no
# Range: 0-100
# Default:
# StartAlerters=3 #报警实例预启动数量
### Option: JavaGateway
# IP address (or hostname) of Zabbix Java gateway.
# Only required if Java pollers are started.
#
# Mandatory: no
# Default:
JavaGateway=192.168.7.101 #javagateway服务器地址,java pollers必须设置
### Option: JavaGatewayPort
# Port that Zabbix Java gateway listens on.
#
# Mandatory: no
# Range: 1024-32767
# Default:
JavaGatewayPort=10052 #javagateway端口
### Option: StartJavaPollers
# Number of pre-forked instances of Java pollers.
#
# Mandatory: no
# Range: 0-1000
# Default:
StartJavaPollers=20 #java轮训实例预启动数量
### Option: StartVMwareCollectors
# Number of pre-forked vmware collector instances.
#
# Mandatory: no
# Range: 0-250
# Default:
# StartVMwareCollectors=0 #用于设置监控VMWARE Esxi主机实例时使用,若为0则不启用,若要监控ESXI主机,此值最少为1,根据监控ESXI数量设置对应数值
### Option: VMwareFrequency
# How often Zabbix will connect to VMware service to obtain a new data.
#
# Mandatory: no
# Range: 10-86400
# Default:
# VMwareFrequency=60 #监控vmware获取最新数据间隔频率,单位为秒
### Option: VMwarePerfFrequency
# How often Zabbix will connect to VMware service to obtain performance data.
#
# Mandatory: no
# Range: 10-86400
# Default:
# VMwarePerfFrequency=60 #监控vmware获取性能数据间隔
### Option: VMwareCacheSize
# Size of VMware cache, in bytes.
# Shared memory size for storing VMware data.
# Only used if VMware collectors are started.
#
# Mandatory: no
# Range: 256K-2G
# Default:
# VMwareCacheSize=8M #vmware数据缓存大小,会占用zabbix server服务器内存
### 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 #snmp触发器临时文件路径
### Option: StartSNMPTrapper
# If 1, SNMP trapper process is started.
#
# Mandatory: no
# Range: 0-1
# Default:
# StartSNMPTrapper=0 #SNMP触发器预启动数量
### 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.
#
# Mandatory: no
# Range: 0-24
# Default:
# HousekeepingFrequency=1 #多少小时清理一次代理端数据库的 history数据
### 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.
# If set to 0 then no limit is used at all. In this case you must know what you are doing!
#
# Mandatory: no
# Range: 0-1000000
# Default:
# MaxHousekeeperDelete=5000 ##每次最多删除历史数据的行数
### Option: CacheSize
# Size of configuration cache, in bytes.
# Shared memory size for storing host, item and trigger data.
#
# Mandatory: no
# Range: 128K-8G
# Default:
# CacheSize=8M #配置信息缓存大小
### Option: CacheUpdateFrequency
# How often Zabbix will perform update of configuration cache, in seconds.
#
# Mandatory: no
# Range: 1-3600
# Default:
# CacheUpdateFrequency=60 #Zabbix更新缓存数据的频率,单位为秒,范围是1-3600
### Option: StartDBSyncers
# Number of pre-forked instances of DB Syncers.
#
# Mandatory: no
# Range: 1-100
# Default:
# StartDBSyncers=4 #zabbix和数据库同步数据的进程数量
### 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 #用于设置划分多少系统共享内存用于存储计算出来的趋势数据,此参数值从一定程度上可影响数据库读压力,范围是128K-2G
### Option: ValueCacheSize
# Size of history value cache, in bytes.
# Shared memory size for caching item history data requests.
# Setting to 0 disables value cache.
#
# 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).
#
# Mandatory: no
# Range: 1-30
# Default:
# Timeout=3
Timeout=4 #数据获取等待超时时间
### Option: TrapperTimeout
# Specifies how many seconds trapper may spend processing new data.
#
# Mandatory: no
# Range: 1-300
# Default:
# TrapperTimeout=300 #触发器处理新数据的最长时间,单位是秒
### Option: UnreachablePeriod
# After how many seconds of unreachability treat a host as unavailable.
#
# Mandatory: no
# Range: 1-3600
# Default:
# UnreachablePeriod=45 #当主机不可达多少秒后,设置为主机不可用,单位是秒,范围是1-3600
### Option: UnavailableDelay
# How often host is checked for availability during the unavailability period, in seconds.
#
# Mandatory: no
# Range: 1-3600
# Default:
# UnavailableDelay=60 #当主机不可用了,多久检查一次该主机的可用性,单位为秒,范围是1-3600
### Option: UnreachableDelay
# How often host is checked for availability during the unreachability period, in seconds.
#
# Mandatory: no
# Range: 1-3600
# Default:
# UnreachableDelay=15 #当主机不可到达了,多久检查一次该主机的可用性,单位为秒,范围是1-3600
### Option: AlertScriptsPath
# Full path to location of custom alert scripts.
# Default depends on compilation options.
# To see the default path run command "zabbix_server --help".
#
# Mandatory: no
# Default:
# AlertScriptsPath=${datadir}/zabbix/alertscripts #监控报警脚本路径,取决于编译时候的datadir参数
### Option: ExternalScripts
# Full path to location of external scripts.
# Default depends on compilation options.
# To see the default path run command "zabbix_server --help".
#
# Mandatory: no
# Default:
# ExternalScripts=${datadir}/zabbix/externalscripts #自定义脚本存储路径
### Option: FpingLocation
# Location of fping.
# Make sure that fping binary has root ownership and SUID flag set.
#
# Mandatory: no
# Default:
# FpingLocation=/usr/sbin/fping #fping命令的位置
### Option: Fping6Location
# Location of fping6.
# Make sure that fping6 binary has root ownership and SUID flag set.
# Make empty if your fping utility is capable to process IPv6 addresses.
#
# Mandatory: no
# Default:
# Fping6Location=/usr/sbin/fping6 #fping6的位置
### Option: SSHKeyLocation
# Location of public and private keys for SSH checks and actions.
#
# Mandatory: no
# Default:
# SSHKeyLocation= #用于SSH检查和操作的公钥和私钥的位置。
### 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 慢日志时间(以毫秒为单位),仅当DebugLevel设置为3,4或5时才可用,0 - 不记录慢查询,范围是1-3600000
LogSlowQueries=3000
### 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 #启用多少子进程与代理端通信,若代理较多可考虑加大此数值,范围是0-250
### 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.
#
# Mandatory: no
# Range: 1-3600*24*7
# Default:
# ProxyConfigFrequency=3600 #proxy被动模式下,server多少秒同步配置文件至proxy,该参数仅用于被动模式下的代理,范围是1-3600*24*7
### 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.
#
# Mandatory: no
# Range: 1-3600
# Default:
# ProxyDataFrequency=1 #被动模式下,zabbix server间隔多少秒向proxy请求历史数据
### 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
#
# Mandatory: no
# Default:
# AllowRoot=0 #是否允许root启动zabbix
### 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 #设置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=/usr/local/etc/zabbix_server.general.conf #导入其他目录的配置文件
# Include=/usr/local/etc/zabbix_server.conf.d/
# Include=/usr/local/etc/zabbix_server.conf.d/*.conf
### Option: SSLCertLocation
# Location of SSL client certificates.
# This parameter is used only in web monitoring.
# Default depends on compilation options.
# To see the default path run command "zabbix_server --help".
#
# Mandatory: no
# Default:
# SSLCertLocation=${datadir}/zabbix/ssl/certs #SSL证书公钥的位置,用于web监控
### Option: SSLKeyLocation
# Location of private keys for SSL client certificates.
# This parameter is used only in web monitoring.
# Default depends on compilation options.
# To see the default path run command "zabbix_server --help".
#
# Mandatory: no
# Default:
# SSLKeyLocation=${datadir}/zabbix/ssl/keys #SSL客证书私钥位置,用于web监控
### Option: SSLCALocation
# Override the location of certificate authority (CA) files for SSL server certificate verification.
# If not set, system-wide directory will be used.
# This parameter is used only in web monitoring and SMTP authentication.
#
# Mandatory: no
# Default:
# SSLCALocation= #SSL CA钥文件目录
### Option: StatsAllowedIP
# List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of external Zabbix instances.
# Stats request will be accepted only from the addresses listed here. If this parameter is not set no stats requests
# will be accepted.
# If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally
# and '::/0' will allow any IPv4 or IPv6 address.
# '0.0.0.0/0' can be used to allow any IPv4 address.
# Example: StatsAllowedIP=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com
#
# Mandatory: no
# Default:
# StatsAllowedIP= #定义允许访问zabbix server的IP地址列表
####### LOADABLE MODULES #######可加载的模块
### Option: LoadModulePath
# Full path to location of server modules.
# Default depends on compilation options.
# To see the default path run command "zabbix_server --help".
#
# Mandatory: no
# Default:
# LoadModulePath=${libdir}/modules #第三方模块目录路径
### Option: LoadModule
# Module to load at server startup. Modules are used to extend functionality of the server.
# Formats:
# LoadModule=<module.so>
# LoadModule=<path/module.so>
# LoadModule=</abs_path/module.so>
# Either the module must be located in directory specified by LoadModulePath or the path must precede the module name.
# If the preceding path is absolute (starts with '/') then LoadModulePath is ignored.
# It is allowed to include multiple LoadModule parameters.
#
# Mandatory: no
# Default:
# LoadModule= #第三方模块路径
####### TLS-RELATED PARAMETERS #######TLS相关参数
### Option: TLSCAFile
# Full pathname of a file containing the top-level CA(s) certificates for
# peer certificate verification.
#
# Mandatory: no
# Default:
# TLSCAFile= #CA文件
### Option: TLSCRLFile
# Full pathname of a file containing revoked certificates.
#
# Mandatory: no
# Default:
# TLSCRLFile= #包含已吊销证书的文件的完整路径名。
### Option: TLSCertFile
# Full pathname of a file containing the server certificate or certificate chain.
#
# Mandatory: no
# Default:
# TLSCertFile= #公钥文件路径
### Option: TLSKeyFile
# Full pathname of a file containing the server private key.
#
# Mandatory: no
# Default:
# TLSKeyFile= #私钥文件路径