Zabbix Documentation 5.0

3.04.04.45.0 (current)| In development:5.2 (devel)| Unsupported:1.82.02.22.43.23.44.2Guidelines

User Tools

Site Tools


Sidebar

manual:config:templates_out_of_the_box:requirements:mysql_agent2

Requirements for MySQL by Zabbix agent 2 template

Overview

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.

Steps

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:

  • Agent configuration file parameters: Plugins.Mysql.Uri (default: tcp://localhost:3306), Plugins.Mysql.User(default: root), Plugins.Mysql.Password (default: none)
  • Agent configuration file named session parameters.
    Examples: 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:

  • Should not include embedded credentials (they will be ignored for security reasons).
  • Must match the URI format.
  • Must contain a scheme (supported: TCP, Unix).
  • A port can be omitted (default=3306).

Examples: tcp://localhost:3306, tcp://localhost, unix:/var/run/mysql.sock

User macros {$MYSQL.USER} and {$MYSQL.PASSWORD} can be used to override login credentials from the configuration file.