Requirements for template operation:

1. Install Zabbix agent and MySQL client. If necessary, add the path to the 'mysql' and 'mysqladmin' utilities to the global environment variable PATH.

2. Copy the 'template_db_mysql.conf' file with user parameters into folder with Zabbix agent configuration (/etc/zabbix/zabbix_agentd.d/ by default). Don't forget to restart Zabbix agent.

3. Create the MySQL user that will be used for monitoring ('<password>' at your discretion). For example:

CREATE USER 'zbx_monitor'@'%' IDENTIFIED BY '<password>';
GRANT REPLICATION CLIENT,PROCESS,SHOW DATABASES,SHOW VIEW ON *.* TO 'zbx_monitor'@'%';

For more information, please see MySQL documentation (https://dev.mysql.com/doc/refman/8.0/en/grant.html).

NOTE: In order to collect replication metrics, MariaDB Enterprise Server 10.5.8-5 and above and MariaDB Community Server 10.5.9 and above require the SLAVE MONITOR privilege to be set for the monitoring user:

GRANT REPLICATION CLIENT,PROCESS,SHOW DATABASES,SHOW VIEW,SLAVE MONITOR ON *.* TO 'zbx_monitor'@'%';

For more information, please read the MariaDB documentation (https://mariadb.com/docs/server/ref/mdb/privileges/SLAVE_MONITOR/).

4. Create '.my.cnf' configuration file in the home directory of Zabbix agent for Linux distributions (/var/lib/zabbix by default) or 'my.cnf' in c:\ for Windows. For example:

[client]
protocol=tcp
user='zbx_monitor'
password='<password>'

For more information, please see MySQL documentation (https://dev.mysql.com/doc/refman/8.0/en/option-files.html).

NOTE: Linux distributions that use SELinux may require additional steps for access configuration.

You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/384189-discussion-thread-for-official-zabbix-template-db-mysql

Generated by official Zabbix template tool "Templator"