Zabbix升级到5.0.17版本后,出现 mysql.db.sizemysql.replication.get_slave_status监控键值报错:

1
Invalid parameters: "TLSConnect" cannot be passed as a key parameter.

原因分析

查询ZABBIX BUGS AND ISSUES 问题与错误,找到类似问题,如下:

Patch 12866d3f110 (26 Jul 2021) has introduced new MySQL connection parameters: TLS encryption. Thus items “mysql.db.size” and “mysql.replication.get_slave_status” now require 7 parameters, not 3 as it was before.
Issue is “DB MySQL by agent 2” template was not patched to comply with changed items’ parameters. So, the latest version of template cannot work properly with zabbix-agent2 that has MySQL TLS encryption support
The fix is to add 4 empty parameters for TLS encryption to the items mentioned earlier.

修补程序12866d3f110 (26 Jul 2021) 引入了新的 MySQL 连接参数: TLS 加密。因此,监控键值mysql.db.sizemysql.repliation.get _ slave _ status现在需要7个参数,而不是之前的3个。问题是Template DB MySQL by Zabbix agent 2模板没有修补以符合更改项目的参数,导致最新版本的模板不能正常工作。

The problem exists since this commit. It changes the keys’ parameter list, but only in zabbix-agent2 source code, not in the template.

image-20220112145052133

解决方法

修改Template DB MySQL by Zabbix agent 2模板中的监控键值:

1
2
mysql.db.size["{$MYSQL.DSN}","{$MYSQL.USER}","{$MYSQL.PASSWORD}","","","","","{#DATABASE}"]
mysql.replication.get_slave_status["{$MYSQL.DSN}","{$MYSQL.USER}","{$MYSQL.PASSWORD}","","","","","{#MASTER_HOST}"]

截止目前,最新开发版本已修复该问题: