2022 Zabbix中国峰会
2022 Zabbix中国峰会

9 Zabbix 4.0.0 升级说明

迄今为止,Zabbix 4.0.0 尚未发布。

此升级说明适用于 Zabbix 3.4.x 升级至 Zabbix 4.0.0。其升级说明被分为:

  • 关键 - 在升级过程和 Zabbix 功能更改相关的最重要信息;
  • 信息 - 描述了除关键说明之外的所有 Zabbix 功能更改信息。

此外,Zabbix 3.4.0 之前的版本同样可以升级到 Zabbix 4.0.0。关于此升级的相关说明,详见 升级步骤 章节。

关键

额外的依赖

  • libpthread - 在 Zabbix 4.0.0 版本,编译 Zabbix server 和 Zabbix proxy 时,必须使用 POSIX Threads 库。 它是进程共享的互斥锁和读写锁所必需的。 如果互斥可用,但进程无法进行共享,那么 Zabbix 将在升级之前返回使用信号量。
  • zlib - 在 Zabbix 4.0.0 版本,编译 Zabbix server 和 Zabbix proxy 时,压缩库 zlib 是必须的。

被动模式 Proxy 配置文件中 Server 参数现在是必需的

在新版本中,在被动模式的 Proxy 配置文件中,其 Server 参数现在是必需的,但之前是忽略的。被动模式的 Proxy 将拒绝 Server 参数中未列出的地址。

删除对纯文本协议的支持

在新版本中,已删除对纯本文协议的支持,现在强制使用Header。当 Zabbix 获取请求时,Zabbix server/proxy 被动检查请求和 Zabbix server 的前端请求均已添加 Header。

因此,Zabbix agent 1.4 之前的版本将不再支持。此外,如果 Header 不存在,来自 sender 的消息将拒绝。在此之前 Zabbix trapper 可以接收带 Headers 和不带 Headers 的消息,而现在之接受带协议 Headers 的消息。

可加载的模块

在新版本中,Zabbix proxy 将不再支持通过模块导出历史记录。

移除了前端的“监测中“ → ”触发器“

在新版本中,移除了前端页面的“监测中”→“触发器”部分。 在前端页面的“管理”→“一般”→“界面设置”中相关的全局参数“显示不大于的事件”和“可展示的每触发器最多事件计数”也将被移除。

不再支持的监控项键值参数语法

在新版本中,将不再支持以下监控项键值参数语法:

  • Multi-level parameter arrays, e.g. [a,[b,[c,d]],e]
  • Zapcat-style parameters, e.g. [a][b]

请注意,此语法从未被官方 Zabbix 监控项键值使用,也并未被正式标记为受支持。 它只存在与 Zapcat JMX Zabbix Bridge 等解决方案的向下兼容中。

MySQL 8.0 支持

在新版本中,为了能够在 Zabbix 4.0.0 版本中添加 MySQL 8.0 的支持,已对其进行了两次数据库更改:

  • 表 'groups' 已重命名为 'hstgrp'
  • 'functions' 表中的 'function' 字段已重命名为 'name'

触发器函数

在新版本中,触发器函数 ** logsource** 参数的值将被转换为与添加支持的正则表达式和全局正则表达式协同工作。 可能存在现有参数包含大量正则表达式特殊字符或其长度接近最大允许限制的情况,并且在转换期间将超过该最大允许长度限制。然后,不会对这些参数进行任何更改。 有关所有此类案例的详细信息将添加到日志文件中。

信息

自动注册更改

在新版本中,自动注册动作已按以下方式进行了一些更改:

  • 如果主机 metadata 更改,那么 Active agent 将重新运行自动注册动作;
  • 由于 metadata 仅在自动注册期间添加,因此手动创建的主机将缺少 metadata,并将重新运行自动注册;
  • 如果主机被手动更改为由其他 Zabbix proxy 监控,则将重新运行自动注册。

和以前一样,如果同一主机的自动注册来自新的 Zabbix proxy,那么将重新运行自动注册。

问题名称生成

在新版本中,问题和事件名称在事件生成时将 直接存储 到数据库中的事件和问题表中,而不像之前那样在运行时生成。在升级至 Zabbix 4.0.0 时,数据库升级补丁将填充新的问题名称和事件名称字段,而不扩展宏。值得注意的是,此更改将会需要更多的存储空间。

如果之前的版本中存在大量的旧事件和触发器名称中使用了 {ITEM.VALUE}、{ITEM.LASTVALUE} 宏, 那么在 Zabbix server 初始化启动期间,数据库升级可能需要较长时间。

其填充的事件和问题名称字段为:

  • 对于触发器事件 - 返回已解析完所有宏的触发器名称
  • 对于内部问题事件:
  * 对于不支持的监控项 - //Cannot obtain item value//
       
         * 对于未知的触发器 - //Cannot calculate trigger expression//
  • 对于其余事件,名称将为空。
相关宏的变化

在新版本中,在与开发相关的宏已做了几处更改:

  • 在默认的消息中,{TRIGGER.NAME} 已替换为 {EVENT.NAME};
  • 在升级到 Zabbix 4.0.0 之后,在关于触发器的动作中,{TRIGGER.NAME} 已替换为 {EVENT.NAME}。

问题处理

在新版本中,已经对处理问题上做了一些更改,包括宏。关于更多细节,详见 Zabbix 4.0.0新特征

相关 API 方法的变化

在新版本中,​problem.get​ 和 ​event.get​ 方法已经改变了输入参数 search/​filter 与对象 {'​name':​ '​...'​} 的值在相应的表("​problem"​ 或 "​events")中查找匹配的结果(按字段 "​name")。

problem.getevent.get 方法通过对添加名为 "​name" 的响应参数进行了扩展。对于这两种方法,新参数包含数据库表 "​problem"​ 或 "​events"​ 中新添加的 "​name"​ 字段的值。

Server 配置缓存的使用

在新版本中,已修改 Server 配置缓存以将所有主机清单信息保留在其中。如果将清单功能与主机一起使用,请相应地增加 Server 的专用配置缓存内存。

外部检查脚本的执行

在新版本中,当完成 外部检查脚本 后,参数将被包装为单引号 ' 而不是双引号 "。此更改允许 Zabbix 在外部检查参数的名称中接受更多符号。例如,$ 符号将不再被忽略。

Zabbix Java Gateway logs 的更改

在新版本中,如果监控 Java Gateway 日志,请记住,Java Gateway 的 Warning 和 Error 级别日志将不再提供 Exception stack trace。

触发器表达式的更改

  • 在新版本中,已更改了触发器表达式中关于数字的行为,相差为 0.000001,由于逻辑运算符是按等于 0 定义的,因此它们对于 0.000001 的结果也会受到影响:
Expression (Example) Evaluation result
Before After
1.000001 > 1 1 0
1.000001 <= 1 0 1
0 >= 0.000001 0 1
0.000001 <> 0 1 0
0.000001 = 0 0 1
0 or (1/1000000) 1 0
not (1/1000000) 0 1
1 and 1/1000000 1 0

关于前端的小部件名称、窗口元素名称和报告名称的更改

在新版本中,下面的元素将被重新命名:

在旧版本中 **在新 本中**
System status Problems by severity
Host status Problem hosts
Status of Zabbix System information

此外,在前端的仪表盘 API 也会受到影响:一些 仪表盘部件属性类型 已被重命名。

Logging 更改

在新版本中,打印到日志文件中的有关完整历史记录缓存的消息已更改。

此消息已更改为如下:

History buffer is full. Sleeping for 1 second. → History cache is full. Sleeping for 1 second.

Since problem names are no longer generated in runtime based on the current trigger name, and instead are being generated at the time of event, there are corresponding macro changes:

  • In all default messages - {TRIGGER.NAME} has been replaced by {EVENT.NAME};
  • In all trigger-based actions - {TRIGGER.NAME} will be replaced by {EVENT.NAME} when upgrading.

See also: known issues

Working with problems

Several changes have been made for working with problems, including changed macros. For more details, see the what's new entry.

​problem.get​ and ​event.get​ methods have been changed in such a way that input parameter search/​filter with object {'​name':​ '​...'​} as value is used to find matching results (by field "​name"​) in the corresponding table ("​problem"​ or "​events"​).

​problem.get​ and ​event.get​ methods have been extended by adding a response parameter called "​name"​. For both methods, the new parameter contains a value from the newly added "​name"​ field in the database table "​problem"​ or "​events"​.

Server configuration cache usage

The server configuration cache has been modified to keep all host inventory information in it. If you are using the inventory functionality with hosts, increase the dedicated configuration cache memory for the server accordingly.

Execution of external check script

Upon completion of an external check script, arguments are wrapped to single quotes ' instead of double quotes ". This change allows Zabbix to accept more signs in an external check parameter's name. For example, the $ sign is no longer ignored.

Zabbix Java gateway availability

From now on Zabbix Java gateway availability status will not change to red each time any of the items become not supported. The JMX availability badge will only become red on network errors - when Java gateway is not available or when there are some communication problems between Zabbix server and Zabbix Java gateway.

Zabbix Java gateway logs modified

If you monitor Java gateway logs, keep in mind that exception stack trace is no longer available in warning and error level logging of Java gateway.

Trigger changes

  • Trigger expression's behavior regarding numbers, differing by 0.000001, is now changed. Since logical operators are defined in terms of equality to zero, their result for 0.000001 is affected too:
Expression (Example) Evaluation result
Before After
1.000001 > 1 1 0
1.000001 <= 1 0 1
0 >= 0.000001 0 1
0.000001 <> 0 1 0
0.000001 = 0 0 1
0 or (1/1000000) 1 0
not (1/1000000) 0 1
1 and 1/1000000 1 0

Renamed widgets, screen elements and reports

The following elements have been renamed:

Previously In Zabbix 4.0
System status Problems by severity
Host status Problem hosts
Status of Zabbix System information

Dashboard API is also affected: some of Dashboard widget property types are now renamed.

Host column always displayed

The host column is now always displayed even if only one host is selected in:

  • MonitoringLatest data
  • MonitoringWeb
  • ReportsAvailability

This results in a wider page than previously with one host data. For more information, see the What's new section.

JMX monitoring error message

As Zabbix Java gateway now supports working with custom MBeans returning non-primitive data types, which override the toString() method, the possible error message has been changed the following way:

Previously: data object type is not primitive: xxx
In Zabbix 4.0: Data object type cannot be converted to string.

Logging changes

The message printed to the log files about a full history cache has been changed the following way:

Previously: History buffer is full. Sleeping for 1 second.
In Zabbix 4.0: History cache is full. Sleeping for 1 second.

See also