这是原厂英文文档的翻译页面. 欢迎帮助我们 完善文档.
2022 Zabbix中国峰会
2022 Zabbix中国峰会

5 前端维护模式

概述

可以暂时禁用 Zabbix Web 前端以禁止对其进行访问。这对于保护 Zabbix 数据库免受用户发起的任何更改非常有用,从而保护数据库的完整性。

当 Zabbix 前端处于维护模式时,可以停止 Zabbix 数据库并执行维护任务。

用户使用已定义IP 地址将能够在维护模式下正常访问前端。

配置

为了启用维护模式,必须修改 maintenance.inc.php 文件(位于网络服务器上 Zabbix HTML 文档目录的 /conf 中)以取消注释以下行:

// 维护模式。
       define('ZBX_DENY_GUI_ACCESS', 1);
       
       // IP 地址数组,允许连接到前端(可选)。
       $ZBX_GUI_ACCESS_IP_RANGE = array('127.0.0.1');
       
       // 警告屏幕上显示的消息(可选)。
       $ZBX_GUI_ACCESS_MESSAGE = 'We are upgrading MySQL database till 15:00. Stay tuned...';

Mostly the maintenance.inc.php file is located in /conf of Zabbix HTML document directory on the web server. However, the location of the directory may differ depending on the operating system and a web server it uses.

For example, the location for:

  • SUSE and RedHat is /etc/zabbix/web/maintenance.inc.php.
  • Debian-based systems is /usr/share/zabbix/conf/.

See also Copying PHP files.

Parameter Details
ZBX_DENY_GUI_ACCESS Enable maintenance mode:
1 – maintenance mode is enabled, disabled otherwise
ZBX_GUI_ACCESS_IP_RANGE Array of IP addresses, which are allowed to connect to frontend (optional).
For example:
array('192.168.1.1', '192.168.1.2')
ZBX_GUI_ACCESS_MESSAGE A message you can enter to inform users about the maintenance (optional).

Note that the location of the /conf directory will vary based on the operating system and web server.

显示

在维护模式下尝试访问 Zabbix 前端时,将显示以下屏幕。屏幕每 30 秒刷新一次,以便在维护结束时无需用户干预即可返回正常状态。

ZBX_GUI_ACCESS_IP_RANGE 中定义的 IP 地址将能够像往常一样访问前端。