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

5 前端维护模式

概述

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

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

来自指定IP地址的用户将能够在维护模式期间正常工作。

配置

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

// Maintenance mode. 
       define('ZBX_DENY_GUI_ACCESS', 1);
       
       // Array of IP addresses, which are allowed to connect to frontend (optional).
       $ZBX_GUI_ACCESS_IP_RANGE = array('127.0.0.1');
       
       // Message shown on warning screen (optional). 
       $ZBX_GUI_ACCESS_MESSAGE = 'We are upgrading MySQL database till 15:00. Stay tuned...';
参数 详 信息
ZBX_DENY_GUI_ACCESS 打开维护模式:
1 – 维护模式已打开,其他的数字表示未打开
ZBX_GUI_ACCESS_IP_RANGE 允许连接到前端的IP地址数组(可选)
例:
array('192.168.1.1', '192.168.1.2')
ZBX_GUI_ACCESS_MESSAGE 您可以输入一条消息来通知用户有关维护的信息(可选)

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).

显示

下图显示了在维护模式下访问Zabbix前端的情况。屏幕每30秒刷新一次,以便在维护结束后,无需用户干预即可恢复正常状态。

在 ZBX_GUI_ACCESS_IP_RANGE 中定义的IP地址可以一直访问前端。