MySQL 插件

概述

配置参数可用于自定义 MySQL 插件的行为。

建议将这些参数指定在它们自己的配置文件中(例如 mysql.conf),而不是写在 agent 2 配置文件中。然后使用 Include 指令将此文件包含到 Zabbix agent 2 配置中。

除非明确说明该参数为必填,否则所有参数均为可选

请注意:

  • 默认值反映的是进程默认值,而不是随软件包提供的配置文件中的值;
  • 值支持环境变量
  • Zabbix 仅支持 UTF-8 编码的配置文件,不支持带 BOM 的文件;
  • 以 "#" 开头的注释仅在行首支持。

Parameter details

Plugins.Mysql.CallTimeout

Specify the maximum amount of time in seconds to wait for a request to be done.

Default: default timeout Range: 1-30

Plugins.Mysql.CustomQueriesPath

Specify full pathname of the directory containing .sql files with custom queries.

Defaults:
/usr/local/share/zabbix/custom-queries/mysql - for Unix systems,
*:\Program Files\Zabbix Agent 2\Custom Queries\Mysql - for Windows systems (where * is the drive name from the ProgramFiles environment variable)

Plugins.Mysql.CustomQueriesEnabled

Enable execution of the mysql.custom.query item key.
If disabled, no queries will be loaded from the custom query directory path.

Default: false Range: true/false

Plugins.Mysql.Default.Password

Specify the default password for a protected MySQL server.

Plugins.Mysql.Default.TLSConnect

Specify the default level of encryption for communications between Zabbix agent 2 and monitored databases.

Range:
required - require TLS connection;
verify_ca - verify certificates;
verify_full - verify certificates and IP address

Plugins.Mysql.Default.TLSCAFile

Specify full pathname of the file containing top-level CA(s) certificates for peer certificate verification, used for encrypted communications between Zabbix agent 2 and monitored databases.

Mandatory: yes, if Plugins.Mysql.Default.TLSConnect is set to verify_ca or verify_full

Plugins.Mysql.Default.TLSCertFile

Specify full pathname of the file containing the agent certificate or certificate chain, used for encrypted communications between Zabbix agent 2 and monitored databases.

Mandatory: yes, if Plugins.Mysql.Default.TLSKeyFile is specified

Plugins.Mysql.Default.TLSKeyFile

Specify full pathname of the file containing the database private key, used for encrypted communications between Zabbix agent 2 and monitored databases.

Mandatory: yes, if Plugins.Mysql.Default.TLSCertFile is specified

Plugins.Mysql.Default.Uri

Specify the default URI for connecting to MySQL server.
Embedded credentials will be ignored.
Supported schemes: tcp, unix
The schema can be omitted.
The port can be omitted (default=3306).

Examples:

tcp://localhost:3306
localhost
unix:/var/run/mysql.sock
Plugins.Mysql.Default.User

Specify the default username for a protected MySQL server.

Plugins.Mysql.KeepAlive

Specify the maximum time of waiting (in seconds) before unused plugin connections are closed.

Default: 300 Range: 60-900

Plugins.Mysql.Sessions.<SessionName>.Password

Specify the named session password for a protected MySQL server.
<SessionName> - define name of a session for using in item keys.

Plugins.Mysql.Sessions.<SessionName>.TLSConnect

Specify the level of named-session encryption for communications between Zabbix agent 2 and monitored databases.
<SessionName> - define name of a session for using in item keys.

Range:
required - require TLS connection;
verify_ca - verify certificates;
verify_full - verify certificates and IP address

Plugins.Mysql.Sessions.<SessionName>.TLSCAFile

Specify full pathname of the file containing top-level CA(s) certificates for named-session peer certificate verification, used for encrypted communications between Zabbix agent 2 and monitored databases.
<SessionName> - define name of a session for using in item keys.

Mandatory: yes, if Plugins.Mysql.Sessions.<SessionName>.TLSConnect is set to verify_ca or verify_full

Plugins.Mysql.Sessions.<SessionName>.TLSCertFile

Specify full pathname of the file containing the named-session agent certificate or certificate chain, used for encrypted communications between Zabbix agent 2 and monitored databases.
<SessionName> - define name of a session for using in item keys.

Mandatory: yes, if Plugins.Mysql.Sessions.<SessionName>.TLSKeyFile is specified

Plugins.Mysql.Sessions.<SessionName>.TLSKeyFile

Specify full pathname of the file containing the named-session database private key, used for encrypted communications between Zabbix agent 2 and monitored databases.
<SessionName> - define name of a session for using in item keys.

Mandatory: yes, if Plugins.Mysql.Sessions.<SessionName>.TLSCertFile is specified

Plugins.Mysql.Sessions.<SessionName>.Uri

Specify the named session URI for connecting to MySQL server.
<SessionName> - define name of a session for using in item keys.
Embedded credentials will be ignored.
Supported schemes: tcp, unix
The schema can be omitted.
The port can be omitted (default=3306).

Examples:

tcp://localhost:3306
localhost
unix:/var/run/mysql.sock
Plugins.Mysql.Sessions.<SessionName>.User

Specify the named session username for a protected MySQL server.
<SessionName> - define name of a session for using in item keys.

Plugins.Mysql.Timeout

Set the maximum time in seconds for waiting when a connection has to be established.

Default: default timeout Range: 1-30

参数

Parameter Mandatory Range Default Description
Plugins.Mysql.CallTimeout no 1-30 global timeout 等待请求完成的最长时间(秒)。
Plugins.Mysql.CustomQueriesPath no Unix 系统为 /usr/local/share/zabbix/custom-queries/mysql

Windows 系统为 *:\Program Files\Zabbix Agent 2\Custom Queries\Mysql,其中 *ProgramFiles 环境变量中的驱动器名称
包含自定义查询 .sql 文件的目录完整路径。
Plugins.Mysql.CustomQueriesEnabled no false 如果设置此参数,则启用 mysql.custom.query 监控项键的执行。若禁用,则不会从自定义查询目录路径加载任何查询。
Plugins.Mysql.Default.Password no 连接 MySQL 的默认密码;如果监控项键或命名会话中未指定值,则使用此密码。
Plugins.Mysql.Default.TLSCAFile no
(yes, if Plugins.Mysql.Default.TLSConnect is set to verify_ca or verify_full)
包含用于对等证书验证的顶级 CA 证书的文件完整路径,用于 Zabbix agent 2 与受监控数据库之间的加密通信;如果命名会话中未指定值,则使用此文件。
Plugins.Mysql.Default.TLSCertFile no
(yes, if Plugins.Mysql.Default.TLSConnect is set to verify_ca or verify_full)
包含 agent 证书或证书链的文件完整路径,用于 Zabbix agent 2 与受监控数据库之间的加密通信;如果命名会话中未指定值,则使用此文件。
Plugins.Mysql.Default.TLSConnect no Zabbix agent 2 与受监控数据库之间通信的加密类型;如果命名会话中未指定值,则使用此设置。

支持的值:
required - 要求 TLS 连接;
verify_ca - 验证证书;
verify_full - 验证证书和 IP 地址。
Plugins.Mysql.Default.TLSKeyFile no
(yes, if Plugins.Mysql.Default.TLSConnect is set to verify_ca or verify_full)
包含用于 Zabbix agent 2 与受监控数据库之间加密通信的数据库私钥的文件完整路径;如果命名会话中未指定值,则使用此文件。
Plugins.Mysql.Default.Uri no tcp://localhost:3306 连接 MySQL 的默认 URI;如果监控项键或命名会话中未指定值,则使用此 URI。

不应包含内嵌凭据(它们将被忽略)。
必须符合 URI 格式。
支持的协议:tcpunix;协议可以省略。
端口可以省略(默认值=3306)。
示例:tcp://localhost:3306
localhost
unix:/var/run/mysql.sock
Plugins.Mysql.Default.User no 连接 MySQL 的默认用户名;如果监控项键或命名会话中未指定值,则使用此用户名。
Plugins.Mysql.KeepAlive no 60-900 300 关闭未使用的插件连接之前的最长等待时间(秒)。
Plugins.Mysql.Sessions.<SessionName>.Password no 命名会话密码。
<SessionName> - 定义一个会话名称,用于监控项键中。
Plugins.Mysql.Sessions.<SessionName>.TLSCAFile no
(yes, if Plugins.Mysql.Sessions.<SessionName>.TLSConnect is set to verify_ca or verify_full)
包含用于对等证书验证的顶级 CA 证书的文件完整路径,用于 Zabbix agent 2 与受监控数据库之间的加密通信。
<SessionName> - 定义一个会话名称,用于监控项键中。
Plugins.Mysql.Sessions.<SessionName>.TLSCertFile yes, if Plugins.Mysql.Sessions.<SessionName>.TLSKeyFile is specified 包含 agent 证书或证书链的文件完整路径,用于 Zabbix agent 2 与受监控数据库之间的加密通信。
<SessionName> - 定义一个会话名称,用于监控项键中。
Plugins.Mysql.Sessions.<SessionName>.TLSConnect no Zabbix agent 2 与受监控数据库之间通信的加密类型。
<SessionName> - 定义一个会话名称,用于监控项键中。

支持的值:
required - 要求 TLS 连接;
verify_ca - 验证证书;
verify_full - 验证证书和 IP 地址。
Plugins.Mysql.Sessions.<SessionName>.TLSKeyFile yes, if Plugins.Mysql.Sessions.<SessionName>.TLSCertFile is specified 包含用于 Zabbix agent 2 与受监控数据库之间加密通信的数据库私钥的文件完整路径。
<SessionName> - 定义一个会话名称,用于监控项键中。
Plugins.Mysql.Sessions.<SessionName>.Uri no 命名会话的连接字符串。
<SessionName> - 定义一个会话名称,用于监控项键中。

不应包含内嵌凭据(它们将被忽略)。
必须符合 URI 格式。
支持的协议:tcpunix;协议可以省略。
端口可以省略(默认值=3306)。
示例:tcp://localhost:3306
localhost
unix:/var/run/mysql.sock
Plugins.Mysql.Sessions.<SessionName>.User no 命名会话用户名。
<SessionName> - 定义一个会话名称,用于监控项键中。
Plugins.Mysql.Timeout no 1-30 global timeout 建立连接时等待的最长时间(秒)。

另请参见: