This section contains the required steps to ensure proper operation of Template DB MySQL by Zabbix agent 2, developed for monitoring DBMS MySQL and its forks (such as MariaDB, etc.). In order for the template to operate correctly, MySQL credentials should be provided in the Zabbix agent 2 configuration.
1. Create MySQL user for monitoring (<password> at your discretion). For example:
CREATE USER 'zbx_monitor'@'%' IDENTIFIED BY '<password>'; GRANT USAGE,REPLICATION CLIENT,PROCESS,SHOW DATABASES,SHOW VIEW ON *.* TO 'zbx_monitor'@'%';
For more information, please see MYSQL documentation.
2. Set in the {$MYSQL.DSN} macro the system data source name of the MySQL instance such as <protocol(host:port or /path/to/socket)/>.
3. Specify MySQL username, password and a URI using one or several of the following methods:
Plugins.Mysql.Uri (default: tcp://localhost:3306), Plugins.Mysql.User(default: root), Plugins.Mysql.Password (default: none)Plugins.Mysql.<Instance1>.Uri, Plugins.Mysql.<Instance1>.User, Plugins.Mysql.<Instance1>.Password; Plugins.Mysql.<Instance2>.Uri, Plugins.Mysql.<Instance2>.User, Plugins.Mysql.<Instance2>.Password, where <Instance1> and <Instance2> are session names which can be used as item key parameters to specify required instance.Make sure, the URI meets the following requirements:
Examples: tcp://localhost:3306, tcp://localhost, unix:/var/run/mysql.sock