5 配置
概述
Zabbix 中的配置包括指定要监控的主机和系统、定义要采集的数据,以及建立在发生问题时如何发送通知。
使用侧边栏导航到相关的配置部分。
关键配置任务
- 设置新的主机或主机组 → 主机和主机组
- 定义要从主机收集哪些数据 → 监控项
- 创建用于检测问题的规则 → 使用触发器进行问题检测
- 配置通知的发送方式 → 事件通知
- 通过仪表板、图形和地图显示监控数据 → 可视化
- 在多个主机之间复用配置 → 模板和模板组, 开箱即用的模板
- 控制用户访问和权限 → 用户和用户组
Configuration best practices
Configuration choices affect performance and maintainability. While every Zabbix setup is different, these best practices can be used as a foundation to adjust as needed.
Separate host for each monitoring instance
A host in Zabbix is a logical entity rather than a physical machine or device. Create a separate host for each independent instance such as a virtual machine, database, container, or network switch.
This approach provides:
-
Cleaner monitoring data with separate items, triggers, and alert notifications for each host.
-
Fine-grained user-access control via user-roles aligned with the principle of least privilege.
Use templates and mass update for similar hosts
For similar hosts like Network switch 1 and Network switch 2, you can create a template with the required metrics (Network switch template) and group the hosts into a host group (Network switches).
When adding new switches, you can use mass update in Data Collection -> Hosts to link the template instead of cloning hosts manually.
Configure master and dependent items to minimize requests
To minimize requests to the target entity, configure a master item to collect data in a single request, then use dependent items with preprocessing to extract specific values.
For example, the master item might collect a JSON or XML response with multiple metrics or execute a database query returning multiple columns (e.g., number of open connections, aborted connections, maximum allowed simultaneous connections, and total cumulative connections since startup), and the dependent items will parse and store each value separately.
Discard the master item's history after collection and only keep only the dependent items' data.
Deploy a Zabbix proxy when needed
If your hosts are all in the same local network as the Zabbix server with no scalability or performance concerns, you may not need a proxy. In larger or more complex environments, a proxy allows for more even load distribution.
Add a Zabbix proxy when:
-
Monitoring multiple hosts using various metric collection methods behind a firewall. The proxy gathers data from hosts and forwards it to Zabbix server, reducing the number of open firewall ports.
-
Monitoring remote locations, branches, or networks. Zabbix proxies in remote locations continue data collection during network interruptions and send the data back when the connection is restored.
-
Managing large-scale deployments. If you have many hosts and/or collect a high number of values per second, deploy a proxy to reduce server load and improve performance.
Configure independent secret macro retrieval
You may want to use secret user macros as either secret text or secret vault macros.
By default, secret macro values are retrieved by Zabbix server and propagated to proxies. For enhanced security with secret vault macros, configure the macro values to be retrieved independently by Zabbix server and proxies.