Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/db/mysql_agent?at=release/7.2
MySQL by Zabbix agent
Overview
This template is designed for the effortless deployment of MySQL monitoring by Zabbix via Zabbix agent and doesn't require any external scripts.
Requirements
Zabbix version: 7.2 and higher.
Tested versions
This template has been tested on:
- MySQL 5.7, 8.0
- Percona 8.0
- MariaDB 10.4, 10.6.8
Configuration
Zabbix should be configured according to the instructions in the Templates out of the box section.
Setup
- Install Zabbix agent and MySQL client. If necessary, add the path to the
mysql
andmysqladmin
utilities to the global environment variable PATH. - 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. - 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
.
- Create
.my.cnf
configuration file in the home directory of Zabbix agent for Linux distributions (/var/lib/zabbix by default) ormy.cnf
in c:\ for Windows. For example:
[client]
protocol=tcp
user='zbx_monitor'
password='<password>'
For more information, please see MySQL documentation
.
NOTE: Linux distributions that use SELinux may require additional steps for access configuration.
For example, the following rule could be added to the SELinux policy:
# cat <<EOF > zabbix_home.te
module zabbix_home 1.0;
require {
type zabbix_agent_t;
type zabbix_var_lib_t;
type mysqld_etc_t;
type mysqld_port_t;
type mysqld_var_run_t;
class file { open read };
class tcp_socket name_connect;
class sock_file write;
}
#============= zabbix_agent_t ==============
allow zabbix_agent_t zabbix_var_lib_t:file read;
allow zabbix_agent_t zabbix_var_lib_t:file open;
allow zabbix_agent_t mysqld_etc_t:file read;
allow zabbix_agent_t mysqld_port_t:tcp_socket name_connect;
allow zabbix_agent_t mysqld_var_run_t:sock_file write;
EOF
# checkmodule -M -m -o zabbix_home.mod zabbix_home.te
# semodule_package -o zabbix_home.pp -m zabbix_home.mod
# semodule -i zabbix_home.pp
# restorecon -R /var/lib/zabbix
Macros used
Name | Description | Default |
---|---|---|
{$MYSQL.ABORTED_CONN.MAX.WARN} | Number of failed attempts to connect to the MySQL server for trigger expressions. |
3 |
{$MYSQL.HOST} | Hostname or IP of MySQL host or container. |
127.0.0.1 |
{$MYSQL.PORT} | MySQL service port. |
3306 |
{$MYSQL.REPL_LAG.MAX.WARN} | Amount of time the slave is behind the master for trigger expressions. |
30m |
{$MYSQL.SLOW_QUERIES.MAX.WARN} | Number of slow queries for trigger expressions. |
3 |
{$MYSQL.BUFF_UTIL.MIN.WARN} | The minimum buffer pool utilization in percentage for trigger expressions. |
50 |
{$MYSQL.CREATED_TMP_TABLES.MAX.WARN} | The maximum number of temporary tables created in memory per second for trigger expressions. |
30 |
{$MYSQL.CREATED_TMP_DISK_TABLES.MAX.WARN} | The maximum number of temporary tables created on a disk per second for trigger expressions. |
10 |
{$MYSQL.CREATED_TMP_FILES.MAX.WARN} | The maximum number of temporary files created on a disk per second for trigger expressions. |
10 |
{$MYSQL.INNODB_LOG_FILES} | Number of physical files in the InnoDB redo log for calculating |
2 |
{$MYSQL.DBNAME.MATCHES} | Filter of discoverable databases. |
.+ |
{$MYSQL.DBNAME.NOT_MATCHES} | Filter to exclude discovered databases. |
information_schema |
Items
Name | Description | Type | Key and additional info |
---|---|---|---|
Get status variables | Gets server global status information. |
Zabbix agent | mysql.get_status_variables["{$MYSQL.HOST}","{$MYSQL.PORT}"] |
Status | MySQL server status. |
Zabbix agent | mysql.ping["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing
|
Version | MySQL server version. |
Zabbix agent | mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing
|
Uptime | Number of seconds that the server has been up. |
Dependent item | mysql.uptime Preprocessing
|
Aborted clients per second | Number of connections that were aborted because the client died without closing the connection properly. |
Dependent item | mysql.aborted_clients.rate Preprocessing
|
Aborted connections per second | Number of failed attempts to connect to the MySQL server. |
Dependent item | mysql.aborted_connects.rate Preprocessing
|
Connection errors accept per second | Number of errors that occurred during calls to |
Dependent item | mysql.connection_errors_accept.rate Preprocessing
|
Connection errors internal per second | Number of refused connections due to internal server errors, for example, out of memory errors, or failed thread starts. |
Dependent item | mysql.connection_errors_internal.rate Preprocessing
|
Connection errors max connections per second | Number of refused connections due to the |
Dependent item | mysql.connection_errors_max_connections.rate Preprocessing
|
Connection errors peer address per second | Number of errors while searching for the connecting client's IP address. |
Dependent item | mysql.connection_errors_peer_address.rate Preprocessing
|
Connection errors select per second | Number of errors during calls to |
Dependent item | mysql.connection_errors_select.rate Preprocessing
|
Connection errors tcpwrap per second | Number of connections the libwrap library has refused. |
Dependent item | mysql.connection_errors_tcpwrap.rate Preprocessing
|
Connections per second | Number of connection attempts (successful or not) to the MySQL server. |
Dependent item | mysql.connections.rate Preprocessing
|
Max used connections | The maximum number of connections that have been in use simultaneously since the server start. |
Dependent item | mysql.max_used_connections Preprocessing
|
Threads cached | Number of threads in the thread cache. |
Dependent item | mysql.threads_cached Preprocessing
|
Threads connected | Number of currently open connections. |
Dependent item | mysql.threads_connected Preprocessing
|
Threads created per second | Number of threads created to handle connections. If the value of |
Dependent item | mysql.threads_created.rate Preprocessing
|
Threads running | Number of threads that are not sleeping. |
Dependent item | mysql.threads_running Preprocessing
|
Buffer pool efficiency | The item shows how effectively the buffer pool is serving reads. |
Calculated | mysql.buffer_pool_efficiency |
Buffer pool utilization | Ratio of used to total pages in the buffer pool. |
Calculated | mysql.buffer_pool_utilization |
Created tmp files on disk per second | How many temporary files |
Dependent item | mysql.created_tmp_files.rate Preprocessing
|
Created tmp tables on disk per second | Number of internal on-disk temporary tables created by the server while executing statements. |
Dependent item | mysql.created_tmp_disk_tables.rate Preprocessing
|
Created tmp tables on memory per second | Number of internal temporary tables created by the server while executing statements. |
Dependent item | mysql.created_tmp_tables.rate Preprocessing
|
InnoDB buffer pool pages free | The total size of the InnoDB buffer pool, in pages. |
Dependent item | mysql.innodb_buffer_pool_pages_free Preprocessing
|
InnoDB buffer pool pages total | The total size of the InnoDB buffer pool, in pages. |
Dependent item | mysql.innodb_buffer_pool_pages_total Preprocessing
|
InnoDB buffer pool read requests | Number of logical read requests. |
Dependent item | mysql.innodb_buffer_pool_read_requests Preprocessing
|
InnoDB buffer pool read requests per second | Number of logical read requests per second. |
Dependent item | mysql.innodb_buffer_pool_read_requests.rate Preprocessing
|
InnoDB buffer pool reads | Number of logical reads that InnoDB could not satisfy from the buffer pool and had to read directly from the disk. |
Dependent item | mysql.innodb_buffer_pool_reads Preprocessing
|
InnoDB buffer pool reads per second | Number of logical reads per second that InnoDB could not satisfy from the buffer pool and had to read directly from the disk. |
Dependent item | mysql.innodb_buffer_pool_reads.rate Preprocessing
|
InnoDB row lock time | The total time spent in acquiring row locks for InnoDB tables, in milliseconds. |
Dependent item | mysql.innodb_row_lock_time Preprocessing
|
InnoDB row lock time max | The maximum time to acquire a row lock for InnoDB tables, in milliseconds. |
Dependent item | mysql.innodb_row_lock_time_max Preprocessing
|
InnoDB row lock waits | Number of times operations on InnoDB tables had to wait for a row lock. |
Dependent item | mysql.innodb_row_lock_waits Preprocessing
|
Slow queries per second | Number of queries that have taken more than |
Dependent item | mysql.slow_queries.rate Preprocessing
|
Bytes received | Number of bytes received from all clients. |
Dependent item | mysql.bytes_received.rate Preprocessing
|
Bytes sent | Number of bytes sent to all clients. |
Dependent item | mysql.bytes_sent.rate Preprocessing
|
Command Delete per second | The |
Dependent item | mysql.com_delete.rate Preprocessing
|
Command Insert per second | The |
Dependent item | mysql.com_insert.rate Preprocessing
|
Command Select per second | The |
Dependent item | mysql.com_select.rate Preprocessing
|
Command Update per second | The |
Dependent item | mysql.com_update.rate Preprocessing
|
Queries per second | Number of statements executed by the server. This variable includes statements executed within stored programs, unlike the |
Dependent item | mysql.queries.rate Preprocessing
|
Questions per second | Number of statements executed by the server. This includes only statements sent to the server by clients and not statements executed within stored programs, unlike the |
Dependent item | mysql.questions.rate Preprocessing
|
Binlog cache disk use | Number of transactions that used a temporary disk cache because they could not fit in the regular binary log cache, being larger than |
Dependent item | mysql.binlog_cache_disk_use Preprocessing
|
Innodb buffer pool wait free | Number of times InnoDB waited for a free page before reading or creating a page. Normally, writes to the InnoDB buffer pool happen in the background. When no clean pages are available, dirty pages are flushed first in order to free some up. This counts the numbers of wait for this operation to finish. If this value is not small, look at the increasing |
Dependent item | mysql.innodb_buffer_pool_wait_free Preprocessing
|
Innodb number open files | Number of open files held by InnoDB. InnoDB only. |
Dependent item | mysql.innodb_num_open_files Preprocessing
|
Open table definitions | Number of cached table definitions. |
Dependent item | mysql.open_table_definitions Preprocessing
|
Open tables | Number of tables that are open. |
Dependent item | mysql.open_tables Preprocessing
|
Innodb log written | Number of bytes written to the InnoDB log. |
Dependent item | mysql.innodb_os_log_written Preprocessing
|
Calculated value of innodb_log_file_size |
|
Calculated | mysql.innodb_log_file_size Preprocessing
|
Triggers
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
MySQL: Service is down | MySQL is down. |
last(/MySQL by Zabbix agent/mysql.ping["{$MYSQL.HOST}","{$MYSQL.PORT}"])=0 |
High | |
MySQL: Version has changed | The MySQL version has changed. Acknowledge to close the problem manually. |
last(/MySQL by Zabbix agent/mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"],#1)<>last(/MySQL by Zabbix agent/mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"],#2) and length(last(/MySQL by Zabbix agent/mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"]))>0 |
Info | Manual close: Yes |
MySQL: Service has been restarted | MySQL uptime is less than 10 minutes. |
last(/MySQL by Zabbix agent/mysql.uptime)<10m |
Info | |
MySQL: Failed to fetch info data | Zabbix has not received any data for items for the last 30 minutes. |
nodata(/MySQL by Zabbix agent/mysql.uptime,30m)=1 |
Info | Depends on:
|
MySQL: Server has aborted connections | The number of failed attempts to connect to the MySQL server is more than |
min(/MySQL by Zabbix agent/mysql.aborted_connects.rate,5m)>{$MYSQL.ABORTED_CONN.MAX.WARN} |
Average | Depends on:
|
MySQL: Refused connections | Number of refused connections due to the |
last(/MySQL by Zabbix agent/mysql.connection_errors_max_connections.rate)>0 |
Average | |
MySQL: Buffer pool utilization is too low | The buffer pool utilization is less than |
max(/MySQL by Zabbix agent/mysql.buffer_pool_utilization,5m)<{$MYSQL.BUFF_UTIL.MIN.WARN} |
Warning | |
MySQL: Number of temporary files created per second is high | The application using the database may be in need of query optimization. |
min(/MySQL by Zabbix agent/mysql.created_tmp_files.rate,5m)>{$MYSQL.CREATED_TMP_FILES.MAX.WARN} |
Warning | |
MySQL: Number of on-disk temporary tables created per second is high | The application using the database may be in need of query optimization. |
min(/MySQL by Zabbix agent/mysql.created_tmp_disk_tables.rate,5m)>{$MYSQL.CREATED_TMP_DISK_TABLES.MAX.WARN} |
Warning | |
MySQL: Number of internal temporary tables created per second is high | The application using the database may be in need of query optimization. |
min(/MySQL by Zabbix agent/mysql.created_tmp_tables.rate,5m)>{$MYSQL.CREATED_TMP_TABLES.MAX.WARN} |
Warning | |
MySQL: Server has slow queries | The number of slow queries is more than |
min(/MySQL by Zabbix agent/mysql.slow_queries.rate,5m)>{$MYSQL.SLOW_QUERIES.MAX.WARN} |
Warning |
LLD rule Database discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
Database discovery | Scanning databases in DBMS. |
Zabbix agent | mysql.db.discovery["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing
|
Item prototypes for Database discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
Size of database {#DBNAME} | Database size. |
Zabbix agent | mysql.dbsize["{$MYSQL.HOST}","{$MYSQL.PORT}","{#DBNAME}"] Preprocessing
|
LLD rule Replication discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
Replication discovery | If "show slave status" returns Master_Host, "Replication: *" items are created. |
Zabbix agent | mysql.replication.discovery["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing
|
Item prototypes for Replication discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
Replication Slave status {#MASTER_HOST} | The item gets status information on the essential parameters of the slave threads. |
Zabbix agent | mysql.slave_status["{$MYSQL.HOST}","{$MYSQL.PORT}","{#MASTER_HOST}"] |
Replication Slave SQL Running State {#MASTER_HOST} | This shows the state of the SQL driver threads. |
Dependent item | mysql.slave_sql_running_state["{#MASTER_HOST}"] Preprocessing
|
Replication Seconds Behind Master {#MASTER_HOST} | The number of seconds that the slave SQL thread is behind processing the master binary log. A high number (or an increasing one) can indicate that the slave is unable to handle events from the master in a timely fashion. |
Dependent item | mysql.seconds_behind_master["{#MASTER_HOST}"] Preprocessing
|
Replication Slave IO Running {#MASTER_HOST} | Whether the I/O thread for reading the master's binary log is running. Normally, you want this to be Yes unless you have not yet started replication or have explicitly stopped it with STOP SLAVE. |
Dependent item | mysql.slave_io_running["{#MASTER_HOST}"] Preprocessing
|
Replication Slave SQL Running {#MASTER_HOST} | Whether the SQL thread for executing events in the relay log is running. As with the I/O thread, this should normally be Yes. |
Dependent item | mysql.slave_sql_running["{#MASTER_HOST}"] Preprocessing
|
Trigger prototypes for Replication discovery
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
MySQL: Replication lag is too high | Replication delay is too long. |
min(/MySQL by Zabbix agent/mysql.seconds_behind_master["{#MASTER_HOST}"],5m)>{$MYSQL.REPL_LAG.MAX.WARN} |
Warning | |
MySQL: The slave I/O thread is not running | Whether the I/O thread for reading the master's binary log is running. |
count(/MySQL by Zabbix agent/mysql.slave_io_running["{#MASTER_HOST}"],#1,"eq","No")=1 |
Average | |
MySQL: The slave I/O thread is not connected to a replication master | Whether the slave I/O thread is connected to the master. |
count(/MySQL by Zabbix agent/mysql.slave_io_running["{#MASTER_HOST}"],#1,"ne","Yes")=1 |
Warning | Depends on:
|
MySQL: The SQL thread is not running | Whether the SQL thread for executing events in the relay log is running. |
count(/MySQL by Zabbix agent/mysql.slave_sql_running["{#MASTER_HOST}"],#1,"eq","No")=1 |
Warning | Depends on:
|
LLD rule MariaDB discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
MariaDB discovery | Used for additional metrics if MariaDB is used. |
Dependent item | mysql.extra_metric.discovery Preprocessing
|
Item prototypes for MariaDB discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
Binlog commits | Total number of transactions committed to the binary log. |
Dependent item | mysql.binlog_commits[{#SINGLETON}] Preprocessing
|
Binlog group commits | Total number of group commits done to the binary log. |
Dependent item | mysql.binlog_group_commits[{#SINGLETON}] Preprocessing
|
Master GTID wait count | The number of times |
Dependent item | mysql.master_gtid_wait_count[{#SINGLETON}] Preprocessing
|
Master GTID wait time | Total number of time spent in |
Dependent item | mysql.master_gtid_wait_time[{#SINGLETON}] Preprocessing
|
Master GTID wait timeouts | Number of timeouts occurring in |
Dependent item | mysql.master_gtid_wait_timeouts[{#SINGLETON}] Preprocessing
|
Feedback
Please report any issues with the template at https://support.zabbix.com
You can also provide feedback, discuss the template, or ask for help at ZABBIX forums
Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/db/mysql_agent?at=release/7.0
MySQL by Zabbix agent
Overview
This template is designed for the effortless deployment of MySQL monitoring by Zabbix via Zabbix agent and doesn't require any external scripts.
Requirements
Zabbix version: 7.0 and higher.
Tested versions
This template has been tested on:
- MySQL 5.7, 8.0
- Percona 8.0
- MariaDB 10.4, 10.6.8
Configuration
Zabbix should be configured according to the instructions in the Templates out of the box section.
Setup
- Install Zabbix agent and MySQL client. If necessary, add the path to the
mysql
andmysqladmin
utilities to the global environment variable PATH. - 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. - 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
.
- Create
.my.cnf
configuration file in the home directory of Zabbix agent for Linux distributions (/var/lib/zabbix by default) ormy.cnf
in c:\ for Windows. For example:
[client]
protocol=tcp
user='zbx_monitor'
password='<password>'
For more information, please see MySQL documentation
.
NOTE: Linux distributions that use SELinux may require additional steps for access configuration.
For example, the following rule could be added to the SELinux policy:
# cat <<EOF > zabbix_home.te
module zabbix_home 1.0;
require {
type zabbix_agent_t;
type zabbix_var_lib_t;
type mysqld_etc_t;
type mysqld_port_t;
type mysqld_var_run_t;
class file { open read };
class tcp_socket name_connect;
class sock_file write;
}
#============= zabbix_agent_t ==============
allow zabbix_agent_t zabbix_var_lib_t:file read;
allow zabbix_agent_t zabbix_var_lib_t:file open;
allow zabbix_agent_t mysqld_etc_t:file read;
allow zabbix_agent_t mysqld_port_t:tcp_socket name_connect;
allow zabbix_agent_t mysqld_var_run_t:sock_file write;
EOF
# checkmodule -M -m -o zabbix_home.mod zabbix_home.te
# semodule_package -o zabbix_home.pp -m zabbix_home.mod
# semodule -i zabbix_home.pp
# restorecon -R /var/lib/zabbix
Macros used
Name | Description | Default |
---|---|---|
{$MYSQL.ABORTED_CONN.MAX.WARN} | Number of failed attempts to connect to the MySQL server for trigger expressions. |
3 |
{$MYSQL.HOST} | Hostname or IP of MySQL host or container. |
127.0.0.1 |
{$MYSQL.PORT} | MySQL service port. |
3306 |
{$MYSQL.REPL_LAG.MAX.WARN} | Amount of time the slave is behind the master for trigger expressions. |
30m |
{$MYSQL.SLOW_QUERIES.MAX.WARN} | Number of slow queries for trigger expressions. |
3 |
{$MYSQL.BUFF_UTIL.MIN.WARN} | The minimum buffer pool utilization in percentage for trigger expressions. |
50 |
{$MYSQL.CREATED_TMP_TABLES.MAX.WARN} | The maximum number of temporary tables created in memory per second for trigger expressions. |
30 |
{$MYSQL.CREATED_TMP_DISK_TABLES.MAX.WARN} | The maximum number of temporary tables created on a disk per second for trigger expressions. |
10 |
{$MYSQL.CREATED_TMP_FILES.MAX.WARN} | The maximum number of temporary files created on a disk per second for trigger expressions. |
10 |
{$MYSQL.INNODB_LOG_FILES} | Number of physical files in the InnoDB redo log for calculating |
2 |
{$MYSQL.DBNAME.MATCHES} | Filter of discoverable databases. |
.+ |
{$MYSQL.DBNAME.NOT_MATCHES} | Filter to exclude discovered databases. |
information_schema |
Items
Name | Description | Type | Key and additional info |
---|---|---|---|
Get status variables | Gets server global status information. |
Zabbix agent | mysql.get_status_variables["{$MYSQL.HOST}","{$MYSQL.PORT}"] |
Status | MySQL server status. |
Zabbix agent | mysql.ping["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing
|
Version | MySQL server version. |
Zabbix agent | mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing
|
Uptime | Number of seconds that the server has been up. |
Dependent item | mysql.uptime Preprocessing
|
Aborted clients per second | Number of connections that were aborted because the client died without closing the connection properly. |
Dependent item | mysql.aborted_clients.rate Preprocessing
|
Aborted connections per second | Number of failed attempts to connect to the MySQL server. |
Dependent item | mysql.aborted_connects.rate Preprocessing
|
Connection errors accept per second | Number of errors that occurred during calls to |
Dependent item | mysql.connection_errors_accept.rate Preprocessing
|
Connection errors internal per second | Number of refused connections due to internal server errors, for example, out of memory errors, or failed thread starts. |
Dependent item | mysql.connection_errors_internal.rate Preprocessing
|
Connection errors max connections per second | Number of refused connections due to the |
Dependent item | mysql.connection_errors_max_connections.rate Preprocessing
|
Connection errors peer address per second | Number of errors while searching for the connecting client's IP address. |
Dependent item | mysql.connection_errors_peer_address.rate Preprocessing
|
Connection errors select per second | Number of errors during calls to |
Dependent item | mysql.connection_errors_select.rate Preprocessing
|
Connection errors tcpwrap per second | Number of connections the libwrap library has refused. |
Dependent item | mysql.connection_errors_tcpwrap.rate Preprocessing
|
Connections per second | Number of connection attempts (successful or not) to the MySQL server. |
Dependent item | mysql.connections.rate Preprocessing
|
Max used connections | The maximum number of connections that have been in use simultaneously since the server start. |
Dependent item | mysql.max_used_connections Preprocessing
|
Threads cached | Number of threads in the thread cache. |
Dependent item | mysql.threads_cached Preprocessing
|
Threads connected | Number of currently open connections. |
Dependent item | mysql.threads_connected Preprocessing
|
Threads created per second | Number of threads created to handle connections. If the value of |
Dependent item | mysql.threads_created.rate Preprocessing
|
Threads running | Number of threads that are not sleeping. |
Dependent item | mysql.threads_running Preprocessing
|
Buffer pool efficiency | The item shows how effectively the buffer pool is serving reads. |
Calculated | mysql.buffer_pool_efficiency |
Buffer pool utilization | Ratio of used to total pages in the buffer pool. |
Calculated | mysql.buffer_pool_utilization |
Created tmp files on disk per second | How many temporary files |
Dependent item | mysql.created_tmp_files.rate Preprocessing
|
Created tmp tables on disk per second | Number of internal on-disk temporary tables created by the server while executing statements. |
Dependent item | mysql.created_tmp_disk_tables.rate Preprocessing
|
Created tmp tables on memory per second | Number of internal temporary tables created by the server while executing statements. |
Dependent item | mysql.created_tmp_tables.rate Preprocessing
|
InnoDB buffer pool pages free | The total size of the InnoDB buffer pool, in pages. |
Dependent item | mysql.innodb_buffer_pool_pages_free Preprocessing
|
InnoDB buffer pool pages total | The total size of the InnoDB buffer pool, in pages. |
Dependent item | mysql.innodb_buffer_pool_pages_total Preprocessing
|
InnoDB buffer pool read requests | Number of logical read requests. |
Dependent item | mysql.innodb_buffer_pool_read_requests Preprocessing
|
InnoDB buffer pool read requests per second | Number of logical read requests per second. |
Dependent item | mysql.innodb_buffer_pool_read_requests.rate Preprocessing
|
InnoDB buffer pool reads | Number of logical reads that InnoDB could not satisfy from the buffer pool and had to read directly from the disk. |
Dependent item | mysql.innodb_buffer_pool_reads Preprocessing
|
InnoDB buffer pool reads per second | Number of logical reads per second that InnoDB could not satisfy from the buffer pool and had to read directly from the disk. |
Dependent item | mysql.innodb_buffer_pool_reads.rate Preprocessing
|
InnoDB row lock time | The total time spent in acquiring row locks for InnoDB tables, in milliseconds. |
Dependent item | mysql.innodb_row_lock_time Preprocessing
|
InnoDB row lock time max | The maximum time to acquire a row lock for InnoDB tables, in milliseconds. |
Dependent item | mysql.innodb_row_lock_time_max Preprocessing
|
InnoDB row lock waits | Number of times operations on InnoDB tables had to wait for a row lock. |
Dependent item | mysql.innodb_row_lock_waits Preprocessing
|
Slow queries per second | Number of queries that have taken more than |
Dependent item | mysql.slow_queries.rate Preprocessing
|
Bytes received | Number of bytes received from all clients. |
Dependent item | mysql.bytes_received.rate Preprocessing
|
Bytes sent | Number of bytes sent to all clients. |
Dependent item | mysql.bytes_sent.rate Preprocessing
|
Command Delete per second | The |
Dependent item | mysql.com_delete.rate Preprocessing
|
Command Insert per second | The |
Dependent item | mysql.com_insert.rate Preprocessing
|
Command Select per second | The |
Dependent item | mysql.com_select.rate Preprocessing
|
Command Update per second | The |
Dependent item | mysql.com_update.rate Preprocessing
|
Queries per second | Number of statements executed by the server. This variable includes statements executed within stored programs, unlike the |
Dependent item | mysql.queries.rate Preprocessing
|
Questions per second | Number of statements executed by the server. This includes only statements sent to the server by clients and not statements executed within stored programs, unlike the |
Dependent item | mysql.questions.rate Preprocessing
|
Binlog cache disk use | Number of transactions that used a temporary disk cache because they could not fit in the regular binary log cache, being larger than |
Dependent item | mysql.binlog_cache_disk_use Preprocessing
|
Innodb buffer pool wait free | Number of times InnoDB waited for a free page before reading or creating a page. Normally, writes to the InnoDB buffer pool happen in the background. When no clean pages are available, dirty pages are flushed first in order to free some up. This counts the numbers of wait for this operation to finish. If this value is not small, look at the increasing |
Dependent item | mysql.innodb_buffer_pool_wait_free Preprocessing
|
Innodb number open files | Number of open files held by InnoDB. InnoDB only. |
Dependent item | mysql.innodb_num_open_files Preprocessing
|
Open table definitions | Number of cached table definitions. |
Dependent item | mysql.open_table_definitions Preprocessing
|
Open tables | Number of tables that are open. |
Dependent item | mysql.open_tables Preprocessing
|
Innodb log written | Number of bytes written to the InnoDB log. |
Dependent item | mysql.innodb_os_log_written Preprocessing
|
Calculated value of innodb_log_file_size |
|
Calculated | mysql.innodb_log_file_size Preprocessing
|
Triggers
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
MySQL: Service is down | MySQL is down. |
last(/MySQL by Zabbix agent/mysql.ping["{$MYSQL.HOST}","{$MYSQL.PORT}"])=0 |
High | |
MySQL: Version has changed | The MySQL version has changed. Acknowledge to close the problem manually. |
last(/MySQL by Zabbix agent/mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"],#1)<>last(/MySQL by Zabbix agent/mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"],#2) and length(last(/MySQL by Zabbix agent/mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"]))>0 |
Info | Manual close: Yes |
MySQL: Service has been restarted | MySQL uptime is less than 10 minutes. |
last(/MySQL by Zabbix agent/mysql.uptime)<10m |
Info | |
MySQL: Failed to fetch info data | Zabbix has not received any data for items for the last 30 minutes. |
nodata(/MySQL by Zabbix agent/mysql.uptime,30m)=1 |
Info | Depends on:
|
MySQL: Server has aborted connections | The number of failed attempts to connect to the MySQL server is more than |
min(/MySQL by Zabbix agent/mysql.aborted_connects.rate,5m)>{$MYSQL.ABORTED_CONN.MAX.WARN} |
Average | Depends on:
|
MySQL: Refused connections | Number of refused connections due to the |
last(/MySQL by Zabbix agent/mysql.connection_errors_max_connections.rate)>0 |
Average | |
MySQL: Buffer pool utilization is too low | The buffer pool utilization is less than |
max(/MySQL by Zabbix agent/mysql.buffer_pool_utilization,5m)<{$MYSQL.BUFF_UTIL.MIN.WARN} |
Warning | |
MySQL: Number of temporary files created per second is high | The application using the database may be in need of query optimization. |
min(/MySQL by Zabbix agent/mysql.created_tmp_files.rate,5m)>{$MYSQL.CREATED_TMP_FILES.MAX.WARN} |
Warning | |
MySQL: Number of on-disk temporary tables created per second is high | The application using the database may be in need of query optimization. |
min(/MySQL by Zabbix agent/mysql.created_tmp_disk_tables.rate,5m)>{$MYSQL.CREATED_TMP_DISK_TABLES.MAX.WARN} |
Warning | |
MySQL: Number of internal temporary tables created per second is high | The application using the database may be in need of query optimization. |
min(/MySQL by Zabbix agent/mysql.created_tmp_tables.rate,5m)>{$MYSQL.CREATED_TMP_TABLES.MAX.WARN} |
Warning | |
MySQL: Server has slow queries | The number of slow queries is more than |
min(/MySQL by Zabbix agent/mysql.slow_queries.rate,5m)>{$MYSQL.SLOW_QUERIES.MAX.WARN} |
Warning |
LLD rule Database discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
Database discovery | Scanning databases in DBMS. |
Zabbix agent | mysql.db.discovery["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing
|
Item prototypes for Database discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
Size of database {#DBNAME} | Database size. |
Zabbix agent | mysql.dbsize["{$MYSQL.HOST}","{$MYSQL.PORT}","{#DBNAME}"] Preprocessing
|
LLD rule Replication discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
Replication discovery | If "show slave status" returns Master_Host, "Replication: *" items are created. |
Zabbix agent | mysql.replication.discovery["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing
|
Item prototypes for Replication discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
Replication Slave status {#MASTER_HOST} | The item gets status information on the essential parameters of the slave threads. |
Zabbix agent | mysql.slave_status["{$MYSQL.HOST}","{$MYSQL.PORT}","{#MASTER_HOST}"] |
Replication Slave SQL Running State {#MASTER_HOST} | This shows the state of the SQL driver threads. |
Dependent item | mysql.slave_sql_running_state["{#MASTER_HOST}"] Preprocessing
|
Replication Seconds Behind Master {#MASTER_HOST} | The number of seconds that the slave SQL thread is behind processing the master binary log. A high number (or an increasing one) can indicate that the slave is unable to handle events from the master in a timely fashion. |
Dependent item | mysql.seconds_behind_master["{#MASTER_HOST}"] Preprocessing
|
Replication Slave IO Running {#MASTER_HOST} | Whether the I/O thread for reading the master's binary log is running. Normally, you want this to be Yes unless you have not yet started replication or have explicitly stopped it with STOP SLAVE. |
Dependent item | mysql.slave_io_running["{#MASTER_HOST}"] Preprocessing
|
Replication Slave SQL Running {#MASTER_HOST} | Whether the SQL thread for executing events in the relay log is running. As with the I/O thread, this should normally be Yes. |
Dependent item | mysql.slave_sql_running["{#MASTER_HOST}"] Preprocessing
|
Trigger prototypes for Replication discovery
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
MySQL: Replication lag is too high | Replication delay is too long. |
min(/MySQL by Zabbix agent/mysql.seconds_behind_master["{#MASTER_HOST}"],5m)>{$MYSQL.REPL_LAG.MAX.WARN} |
Warning | |
MySQL: The slave I/O thread is not running | Whether the I/O thread for reading the master's binary log is running. |
count(/MySQL by Zabbix agent/mysql.slave_io_running["{#MASTER_HOST}"],#1,"eq","No")=1 |
Average | |
MySQL: The slave I/O thread is not connected to a replication master | Whether the slave I/O thread is connected to the master. |
count(/MySQL by Zabbix agent/mysql.slave_io_running["{#MASTER_HOST}"],#1,"ne","Yes")=1 |
Warning | Depends on:
|
MySQL: The SQL thread is not running | Whether the SQL thread for executing events in the relay log is running. |
count(/MySQL by Zabbix agent/mysql.slave_sql_running["{#MASTER_HOST}"],#1,"eq","No")=1 |
Warning | Depends on:
|
LLD rule MariaDB discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
MariaDB discovery | Used for additional metrics if MariaDB is used. |
Dependent item | mysql.extra_metric.discovery Preprocessing
|
Item prototypes for MariaDB discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
Binlog commits | Total number of transactions committed to the binary log. |
Dependent item | mysql.binlog_commits[{#SINGLETON}] Preprocessing
|
Binlog group commits | Total number of group commits done to the binary log. |
Dependent item | mysql.binlog_group_commits[{#SINGLETON}] Preprocessing
|
Master GTID wait count | The number of times |
Dependent item | mysql.master_gtid_wait_count[{#SINGLETON}] Preprocessing
|
Master GTID wait time | Total number of time spent in |
Dependent item | mysql.master_gtid_wait_time[{#SINGLETON}] Preprocessing
|
Master GTID wait timeouts | Number of timeouts occurring in |
Dependent item | mysql.master_gtid_wait_timeouts[{#SINGLETON}] Preprocessing
|
Feedback
Please report any issues with the template at https://support.zabbix.com
You can also provide feedback, discuss the template, or ask for help at ZABBIX forums
Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/db/mysql_agent?at=release/6.4
MySQL by Zabbix agent
Overview
This template is designed for the effortless deployment of MySQL monitoring by Zabbix via Zabbix agent and doesn't require any external scripts.
Requirements
Zabbix version: 6.4 and higher.
Tested versions
This template has been tested on:
- MySQL 5.7, 8.0
- Percona 8.0
- MariaDB 10.4, 10.6.8
Configuration
Zabbix should be configured according to the instructions in the Templates out of the box section.
Setup
- Install Zabbix agent and MySQL client. If necessary, add the path to the
mysql
andmysqladmin
utilities to the global environment variable PATH. - 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. - 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
.
- Create
.my.cnf
configuration file in the home directory of Zabbix agent for Linux distributions (/var/lib/zabbix by default) ormy.cnf
in c:\ for Windows. For example:
[client]
protocol=tcp
user='zbx_monitor'
password='<password>'
For more information, please see MySQL documentation
.
NOTE: Linux distributions that use SELinux may require additional steps for access configuration.
For example, the following rule could be added to the SELinux policy:
# cat <<EOF > zabbix_home.te
module zabbix_home 1.0;
require {
type zabbix_agent_t;
type zabbix_var_lib_t;
type mysqld_etc_t;
type mysqld_port_t;
type mysqld_var_run_t;
class file { open read };
class tcp_socket name_connect;
class sock_file write;
}
#============= zabbix_agent_t ==============
allow zabbix_agent_t zabbix_var_lib_t:file read;
allow zabbix_agent_t zabbix_var_lib_t:file open;
allow zabbix_agent_t mysqld_etc_t:file read;
allow zabbix_agent_t mysqld_port_t:tcp_socket name_connect;
allow zabbix_agent_t mysqld_var_run_t:sock_file write;
EOF
# checkmodule -M -m -o zabbix_home.mod zabbix_home.te
# semodule_package -o zabbix_home.pp -m zabbix_home.mod
# semodule -i zabbix_home.pp
# restorecon -R /var/lib/zabbix
Macros used
Name | Description | Default |
---|---|---|
{$MYSQL.ABORTED_CONN.MAX.WARN} | Number of failed attempts to connect to the MySQL server for trigger expressions. |
3 |
{$MYSQL.HOST} | Hostname or IP of MySQL host or container. |
127.0.0.1 |
{$MYSQL.PORT} | MySQL service port. |
3306 |
{$MYSQL.REPL_LAG.MAX.WARN} | Amount of time the slave is behind the master for trigger expressions. |
30m |
{$MYSQL.SLOW_QUERIES.MAX.WARN} | Number of slow queries for trigger expressions. |
3 |
{$MYSQL.BUFF_UTIL.MIN.WARN} | The minimum buffer pool utilization in percentage for trigger expressions. |
50 |
{$MYSQL.CREATED_TMP_TABLES.MAX.WARN} | The maximum number of temporary tables created in memory per second for trigger expressions. |
30 |
{$MYSQL.CREATED_TMP_DISK_TABLES.MAX.WARN} | The maximum number of temporary tables created on a disk per second for trigger expressions. |
10 |
{$MYSQL.CREATED_TMP_FILES.MAX.WARN} | The maximum number of temporary files created on a disk per second for trigger expressions. |
10 |
{$MYSQL.INNODB_LOG_FILES} | Number of physical files in the InnoDB redo log for calculating |
2 |
{$MYSQL.DBNAME.MATCHES} | Filter of discoverable databases. |
.+ |
{$MYSQL.DBNAME.NOT_MATCHES} | Filter to exclude discovered databases. |
information_schema |
Items
Name | Description | Type | Key and additional info |
---|---|---|---|
MySQL: Get status variables | Gets server global status information. |
Zabbix agent | mysql.get_status_variables["{$MYSQL.HOST}","{$MYSQL.PORT}"] |
MySQL: Status | MySQL server status. |
Zabbix agent | mysql.ping["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing
|
MySQL: Version | MySQL server version. |
Zabbix agent | mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing
|
MySQL: Uptime | Number of seconds that the server has been up. |
Dependent item | mysql.uptime Preprocessing
|
MySQL: Aborted clients per second | Number of connections that were aborted because the client died without closing the connection properly. |
Dependent item | mysql.aborted_clients.rate Preprocessing
|
MySQL: Aborted connections per second | Number of failed attempts to connect to the MySQL server. |
Dependent item | mysql.aborted_connects.rate Preprocessing
|
MySQL: Connection errors accept per second | Number of errors that occurred during calls to |
Dependent item | mysql.connection_errors_accept.rate Preprocessing
|
MySQL: Connection errors internal per second | Number of refused connections due to internal server errors, for example, out of memory errors, or failed thread starts. |
Dependent item | mysql.connection_errors_internal.rate Preprocessing
|
MySQL: Connection errors max connections per second | Number of refused connections due to the |
Dependent item | mysql.connection_errors_max_connections.rate Preprocessing
|
MySQL: Connection errors peer address per second | Number of errors while searching for the connecting client's IP address. |
Dependent item | mysql.connection_errors_peer_address.rate Preprocessing
|
MySQL: Connection errors select per second | Number of errors during calls to |
Dependent item | mysql.connection_errors_select.rate Preprocessing
|
MySQL: Connection errors tcpwrap per second | Number of connections the libwrap library has refused. |
Dependent item | mysql.connection_errors_tcpwrap.rate Preprocessing
|
MySQL: Connections per second | Number of connection attempts (successful or not) to the MySQL server. |
Dependent item | mysql.connections.rate Preprocessing
|
MySQL: Max used connections | The maximum number of connections that have been in use simultaneously since the server start. |
Dependent item | mysql.max_used_connections Preprocessing
|
MySQL: Threads cached | Number of threads in the thread cache. |
Dependent item | mysql.threads_cached Preprocessing
|
MySQL: Threads connected | Number of currently open connections. |
Dependent item | mysql.threads_connected Preprocessing
|
MySQL: Threads created per second | Number of threads created to handle connections. If the value of |
Dependent item | mysql.threads_created.rate Preprocessing
|
MySQL: Threads running | Number of threads that are not sleeping. |
Dependent item | mysql.threads_running Preprocessing
|
MySQL: Buffer pool efficiency | The item shows how effectively the buffer pool is serving reads. |
Calculated | mysql.buffer_pool_efficiency |
MySQL: Buffer pool utilization | Ratio of used to total pages in the buffer pool. |
Calculated | mysql.buffer_pool_utilization |
MySQL: Created tmp files on disk per second | How many temporary files |
Dependent item | mysql.created_tmp_files.rate Preprocessing
|
MySQL: Created tmp tables on disk per second | Number of internal on-disk temporary tables created by the server while executing statements. |
Dependent item | mysql.created_tmp_disk_tables.rate Preprocessing
|
MySQL: Created tmp tables on memory per second | Number of internal temporary tables created by the server while executing statements. |
Dependent item | mysql.created_tmp_tables.rate Preprocessing
|
MySQL: InnoDB buffer pool pages free | The total size of the InnoDB buffer pool, in pages. |
Dependent item | mysql.innodb_buffer_pool_pages_free Preprocessing
|
MySQL: InnoDB buffer pool pages total | The total size of the InnoDB buffer pool, in pages. |
Dependent item | mysql.innodb_buffer_pool_pages_total Preprocessing
|
MySQL: InnoDB buffer pool read requests | Number of logical read requests. |
Dependent item | mysql.innodb_buffer_pool_read_requests Preprocessing
|
MySQL: InnoDB buffer pool read requests per second | Number of logical read requests per second. |
Dependent item | mysql.innodb_buffer_pool_read_requests.rate Preprocessing
|
MySQL: InnoDB buffer pool reads | Number of logical reads that InnoDB could not satisfy from the buffer pool and had to read directly from the disk. |
Dependent item | mysql.innodb_buffer_pool_reads Preprocessing
|
MySQL: InnoDB buffer pool reads per second | Number of logical reads per second that InnoDB could not satisfy from the buffer pool and had to read directly from the disk. |
Dependent item | mysql.innodb_buffer_pool_reads.rate Preprocessing
|
MySQL: InnoDB row lock time | The total time spent in acquiring row locks for InnoDB tables, in milliseconds. |
Dependent item | mysql.innodb_row_lock_time Preprocessing
|
MySQL: InnoDB row lock time max | The maximum time to acquire a row lock for InnoDB tables, in milliseconds. |
Dependent item | mysql.innodb_row_lock_time_max Preprocessing
|
MySQL: InnoDB row lock waits | Number of times operations on InnoDB tables had to wait for a row lock. |
Dependent item | mysql.innodb_row_lock_waits Preprocessing
|
MySQL: Slow queries per second | Number of queries that have taken more than |
Dependent item | mysql.slow_queries.rate Preprocessing
|
MySQL: Bytes received | Number of bytes received from all clients. |
Dependent item | mysql.bytes_received.rate Preprocessing
|
MySQL: Bytes sent | Number of bytes sent to all clients. |
Dependent item | mysql.bytes_sent.rate Preprocessing
|
MySQL: Command Delete per second | The |
Dependent item | mysql.com_delete.rate Preprocessing
|
MySQL: Command Insert per second | The |
Dependent item | mysql.com_insert.rate Preprocessing
|
MySQL: Command Select per second | The |
Dependent item | mysql.com_select.rate Preprocessing
|
MySQL: Command Update per second | The |
Dependent item | mysql.com_update.rate Preprocessing
|
MySQL: Queries per second | Number of statements executed by the server. This variable includes statements executed within stored programs, unlike the |
Dependent item | mysql.queries.rate Preprocessing
|
MySQL: Questions per second | Number of statements executed by the server. This includes only statements sent to the server by clients and not statements executed within stored programs, unlike the |
Dependent item | mysql.questions.rate Preprocessing
|
MySQL: Binlog cache disk use | Number of transactions that used a temporary disk cache because they could not fit in the regular binary log cache, being larger than |
Dependent item | mysql.binlog_cache_disk_use Preprocessing
|
MySQL: Innodb buffer pool wait free | Number of times InnoDB waited for a free page before reading or creating a page. Normally, writes to the InnoDB buffer pool happen in the background. When no clean pages are available, dirty pages are flushed first in order to free some up. This counts the numbers of wait for this operation to finish. If this value is not small, look at the increasing |
Dependent item | mysql.innodb_buffer_pool_wait_free Preprocessing
|
MySQL: Innodb number open files | Number of open files held by InnoDB. InnoDB only. |
Dependent item | mysql.innodb_num_open_files Preprocessing
|
MySQL: Open table definitions | Number of cached table definitions. |
Dependent item | mysql.open_table_definitions Preprocessing
|
MySQL: Open tables | Number of tables that are open. |
Dependent item | mysql.open_tables Preprocessing
|
MySQL: Innodb log written | Number of bytes written to the InnoDB log. |
Dependent item | mysql.innodb_os_log_written Preprocessing
|
MySQL: Calculated value of innodb_log_file_size |
|
Calculated | mysql.innodb_log_file_size Preprocessing
|
Triggers
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
MySQL: Service is down | MySQL is down. |
last(/MySQL by Zabbix agent/mysql.ping["{$MYSQL.HOST}","{$MYSQL.PORT}"])=0 |
High | |
MySQL: Version has changed | The MySQL version has changed. Acknowledge to close the problem manually. |
last(/MySQL by Zabbix agent/mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"],#1)<>last(/MySQL by Zabbix agent/mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"],#2) and length(last(/MySQL by Zabbix agent/mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"]))>0 |
Info | Manual close: Yes |
MySQL: Service has been restarted | MySQL uptime is less than 10 minutes. |
last(/MySQL by Zabbix agent/mysql.uptime)<10m |
Info | |
MySQL: Failed to fetch info data | Zabbix has not received any data for items for the last 30 minutes. |
nodata(/MySQL by Zabbix agent/mysql.uptime,30m)=1 |
Info | Depends on:
|
MySQL: Server has aborted connections | The number of failed attempts to connect to the MySQL server is more than |
min(/MySQL by Zabbix agent/mysql.aborted_connects.rate,5m)>{$MYSQL.ABORTED_CONN.MAX.WARN} |
Average | Depends on:
|
MySQL: Refused connections | Number of refused connections due to the |
last(/MySQL by Zabbix agent/mysql.connection_errors_max_connections.rate)>0 |
Average | |
MySQL: Buffer pool utilization is too low | The buffer pool utilization is less than |
max(/MySQL by Zabbix agent/mysql.buffer_pool_utilization,5m)<{$MYSQL.BUFF_UTIL.MIN.WARN} |
Warning | |
MySQL: Number of temporary files created per second is high | The application using the database may be in need of query optimization. |
min(/MySQL by Zabbix agent/mysql.created_tmp_files.rate,5m)>{$MYSQL.CREATED_TMP_FILES.MAX.WARN} |
Warning | |
MySQL: Number of on-disk temporary tables created per second is high | The application using the database may be in need of query optimization. |
min(/MySQL by Zabbix agent/mysql.created_tmp_disk_tables.rate,5m)>{$MYSQL.CREATED_TMP_DISK_TABLES.MAX.WARN} |
Warning | |
MySQL: Number of internal temporary tables created per second is high | The application using the database may be in need of query optimization. |
min(/MySQL by Zabbix agent/mysql.created_tmp_tables.rate,5m)>{$MYSQL.CREATED_TMP_TABLES.MAX.WARN} |
Warning | |
MySQL: Server has slow queries | The number of slow queries is more than |
min(/MySQL by Zabbix agent/mysql.slow_queries.rate,5m)>{$MYSQL.SLOW_QUERIES.MAX.WARN} |
Warning |
LLD rule Database discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
Database discovery | Scanning databases in DBMS. |
Zabbix agent | mysql.db.discovery["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing
|
Item prototypes for Database discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
MySQL: Size of database {#DBNAME} | Database size. |
Zabbix agent | mysql.dbsize["{$MYSQL.HOST}","{$MYSQL.PORT}","{#DBNAME}"] Preprocessing
|
LLD rule Replication discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
Replication discovery | If "show slave status" returns Master_Host, "Replication: *" items are created. |
Zabbix agent | mysql.replication.discovery["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing
|
Item prototypes for Replication discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
MySQL: Replication Slave status {#MASTER_HOST} | The item gets status information on the essential parameters of the slave threads. |
Zabbix agent | mysql.slave_status["{$MYSQL.HOST}","{$MYSQL.PORT}","{#MASTER_HOST}"] |
MySQL: Replication Slave SQL Running State {#MASTER_HOST} | This shows the state of the SQL driver threads. |
Dependent item | mysql.slave_sql_running_state["{#MASTER_HOST}"] Preprocessing
|
MySQL: Replication Seconds Behind Master {#MASTER_HOST} | The number of seconds that the slave SQL thread is behind processing the master binary log. A high number (or an increasing one) can indicate that the slave is unable to handle events from the master in a timely fashion. |
Dependent item | mysql.seconds_behind_master["{#MASTER_HOST}"] Preprocessing
|
MySQL: Replication Slave IO Running {#MASTER_HOST} | Whether the I/O thread for reading the master's binary log is running. Normally, you want this to be Yes unless you have not yet started replication or have explicitly stopped it with STOP SLAVE. |
Dependent item | mysql.slave_io_running["{#MASTER_HOST}"] Preprocessing
|
MySQL: Replication Slave SQL Running {#MASTER_HOST} | Whether the SQL thread for executing events in the relay log is running. As with the I/O thread, this should normally be Yes. |
Dependent item | mysql.slave_sql_running["{#MASTER_HOST}"] Preprocessing
|
Trigger prototypes for Replication discovery
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
MySQL: Replication lag is too high | Replication delay is too long. |
min(/MySQL by Zabbix agent/mysql.seconds_behind_master["{#MASTER_HOST}"],5m)>{$MYSQL.REPL_LAG.MAX.WARN} |
Warning | |
MySQL: The slave I/O thread is not running | Whether the I/O thread for reading the master's binary log is running. |
count(/MySQL by Zabbix agent/mysql.slave_io_running["{#MASTER_HOST}"],#1,"eq","No")=1 |
Average | |
MySQL: The slave I/O thread is not connected to a replication master | Whether the slave I/O thread is connected to the master. |
count(/MySQL by Zabbix agent/mysql.slave_io_running["{#MASTER_HOST}"],#1,"ne","Yes")=1 |
Warning | Depends on:
|
MySQL: The SQL thread is not running | Whether the SQL thread for executing events in the relay log is running. |
count(/MySQL by Zabbix agent/mysql.slave_sql_running["{#MASTER_HOST}"],#1,"eq","No")=1 |
Warning | Depends on:
|
LLD rule MariaDB discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
MariaDB discovery | Used for additional metrics if MariaDB is used. |
Dependent item | mysql.extra_metric.discovery Preprocessing
|
Item prototypes for MariaDB discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
MySQL: Binlog commits | Total number of transactions committed to the binary log. |
Dependent item | mysql.binlog_commits[{#SINGLETON}] Preprocessing
|
MySQL: Binlog group commits | Total number of group commits done to the binary log. |
Dependent item | mysql.binlog_group_commits[{#SINGLETON}] Preprocessing
|
MySQL: Master GTID wait count | The number of times |
Dependent item | mysql.master_gtid_wait_count[{#SINGLETON}] Preprocessing
|
MySQL: Master GTID wait time | Total number of time spent in |
Dependent item | mysql.master_gtid_wait_time[{#SINGLETON}] Preprocessing
|
MySQL: Master GTID wait timeouts | Number of timeouts occurring in |
Dependent item | mysql.master_gtid_wait_timeouts[{#SINGLETON}] Preprocessing
|
Feedback
Please report any issues with the template at https://support.zabbix.com
You can also provide feedback, discuss the template, or ask for help at ZABBIX forums
Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/db/mysql_agent?at=release/6.2
MySQL by Zabbix agent
Overview
For Zabbix version: 6.2 and higher
The template is developed for monitoring DBMS MySQL and its forks.
This template was tested on:
- MySQL, version 5.7, 8.0
- Percona, version 8.0
- MariaDB, version 10.4, 10.6.8
Setup
See Zabbix template operation for basic instructions.
- Install Zabbix agent and MySQL client. If necessary, add the path to the
mysql
andmysqladmin
utilities to the global environment variable PATH. - Copy
template_db_mysql.conf
into the folder with Zabbix agent configuration (/etc/zabbix/zabbix_agentd.d/
by default). Don't forget to restart Zabbix agent. - Create a MySQL user for monitoring (
<password>
at your discretion):
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
- Create
.my.cnf
in the home directory of Zabbix agent for Linux (/var/lib/zabbix
by default ) ormy.cnf
in c:\ for Windows. The file must have three strings:
[client]
user='zbx_monitor'
password='<password>'
NOTE: Use systemd to start Zabbix agent on Linux OS. For example, in Centos use "systemctl edit zabbix-agent.service" to set the required user to start the Zabbix agent.
Add the rule to the SELinux policy (example for Centos):
# cat <<EOF > zabbix_home.te
module zabbix_home 1.0;
require {
type zabbix_agent_t;
type zabbix_var_lib_t;
type mysqld_etc_t;
type mysqld_port_t;
type mysqld_var_run_t;
class file { open read };
class tcp_socket name_connect;
class sock_file write;
}
#============= zabbix_agent_t ==============
allow zabbix_agent_t zabbix_var_lib_t:file read;
allow zabbix_agent_t zabbix_var_lib_t:file open;
allow zabbix_agent_t mysqld_etc_t:file read;
allow zabbix_agent_t mysqld_port_t:tcp_socket name_connect;
allow zabbix_agent_t mysqld_var_run_t:sock_file write;
EOF
# checkmodule -M -m -o zabbix_home.mod zabbix_home.te
# semodule_package -o zabbix_home.pp -m zabbix_home.mod
# semodule -i zabbix_home.pp
# restorecon -R /var/lib/zabbix
Zabbix configuration
No specific Zabbix configuration is required.
Macros used
Name | Description | Default |
---|---|---|
{$MYSQL.ABORTED_CONN.MAX.WARN} | The number of failed attempts to connect to the MySQL server for trigger expression. |
3 |
{$MYSQL.BUFF_UTIL.MIN.WARN} | The minimum buffer pool utilization in percentage for trigger expression. |
50 |
{$MYSQL.CREATED_TMP_DISK_TABLES.MAX.WARN} | The maximum number of created tmp tables on a disk per second for trigger expressions. |
10 |
{$MYSQL.CREATED_TMP_FILES.MAX.WARN} | The maximum number of created tmp files on a disk per second for trigger expressions. |
10 |
{$MYSQL.CREATED_TMP_TABLES.MAX.WARN} | The maximum number of created tmp tables in memory per second for trigger expressions. |
30 |
{$MYSQL.HOST} | Hostname or IP of MySQL host or container. |
127.0.0.1 |
{$MYSQL.INNODB_LOG_FILES} | Number of physical files in the InnoDB redo log for calculating innodb_log_file_size. |
2 |
{$MYSQL.PORT} | MySQL service port. |
3306 |
{$MYSQL.REPL_LAG.MAX.WARN} | The lag of slave from master for trigger expression. |
30m |
{$MYSQL.SLOW_QUERIES.MAX.WARN} | The number of slow queries for trigger expression. |
3 |
Template links
There are no template links in this template.
Discovery rules
Name | Description | Type | Key and additional info |
---|---|---|---|
Database discovery | Scanning databases in DBMS. |
ZABBIX_PASSIVE | mysql.db.discovery["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing: - JAVASCRIPT: - DISCARD_UNCHANGED_HEARTBEAT: Filter: AND_OR- {#DBNAME} NOT_MATCHES_REGEX |
MariaDB discovery | Additional metrics if MariaDB is used. |
DEPENDENT | mysql.extra_metric.discovery Preprocessing: - JAVASCRIPT: |
Replication discovery | If "show slave status" returns Master_Host, "Replication: *" items are created. |
ZABBIX_PASSIVE | mysql.replication.discovery["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing: - JAVASCRIPT: - DISCARD_UNCHANGED_HEARTBEAT: |
Items collected
Group | Name | Description | Type | Key and additional info |
---|---|---|---|---|
MySQL | MySQL: Status | ZABBIX_PASSIVE | mysql.ping["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing: - JAVASCRIPT: - DISCARD_UNCHANGED_HEARTBEAT: |
|
MySQL | MySQL: Version | ZABBIX_PASSIVE | mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing: - REGEX: - DISCARD_UNCHANGED_HEARTBEAT: |
|
MySQL | MySQL: Uptime | The amount of seconds that the server has been up. |
DEPENDENT | mysql.uptime Preprocessing: - XMLPATH: |
MySQL | MySQL: Aborted clients per second | Number of connections that were aborted because the client died without closing the connection properly. |
DEPENDENT | mysql.aborted_clients.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Aborted connections per second | Number of failed attempts to connect to the MySQL server. |
DEPENDENT | mysql.aborted_connects.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Connection errors accept per second | Number of errors that occurred during calls to accept() on the listening port. |
DEPENDENT | mysql.connection_errors_accept.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Connection errors internal per second | Number of refused connections due to internal server errors, for example, out of memory errors, or failed thread starts. |
DEPENDENT | mysql.connection_errors_internal.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Connection errors max connections per second | Number of refused connections due to the max_connections limit being reached. |
DEPENDENT | mysql.connection_errors_max_connections.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Connection errors peer address per second | Number of errors while searching for the connecting client IP address. |
DEPENDENT | mysql.connection_errors_peer_address.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Connection errors select per second | Number of errors during calls to select() or poll() on the listening port. The client would not necessarily have been rejected in these cases. |
DEPENDENT | mysql.connection_errors_select.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Connection errors tcpwrap per second | Number of connections the libwrap library has refused. |
DEPENDENT | mysql.connection_errors_tcpwrap.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Connections per second | Number of connection attempts (successful or not) to the MySQL server. |
DEPENDENT | mysql.connections.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Max used connections | The maximum number of connections that have been in use simultaneously since the server start. |
DEPENDENT | mysql.max_used_connections Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Threads cached | Number of threads in the thread cache. |
DEPENDENT | mysql.threads_cached Preprocessing: - XMLPATH: |
MySQL | MySQL: Threads connected | Number of currently open connections. |
DEPENDENT | mysql.threads_connected Preprocessing: - XMLPATH: |
MySQL | MySQL: Threads created per second | Number of threads created to handle connections. If Threads_created is big, you may want to increase the thread_cache_size value. The cache miss rate can be calculated as Threads_created/Connections. |
DEPENDENT | mysql.threads_created.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Threads running | Number of threads which are not sleeping. |
DEPENDENT | mysql.threads_running Preprocessing: - XMLPATH: |
MySQL | MySQL: Buffer pool efficiency | The item shows how effectively the buffer pool is serving reads. |
CALCULATED | mysql.buffer_pool_efficiency Expression: last(//mysql.innodb_buffer_pool_reads) / ( last(//mysql.innodb_buffer_pool_read_requests) + ( last(//mysql.innodb_buffer_pool_read_requests) = 0 ) ) * 100 * ( last(//mysql.innodb_buffer_pool_read_requests) > 0 ) |
MySQL | MySQL: Buffer pool utilization | Ratio of used to total pages in the buffer pool. |
CALCULATED | mysql.buffer_pool_utilization Expression: ( last(//mysql.innodb_buffer_pool_pages_total) - last(//mysql.innodb_buffer_pool_pages_free) ) / ( last(//mysql.innodb_buffer_pool_pages_total) + ( last(//mysql.innodb_buffer_pool_pages_total) = 0 ) ) * 100 * ( last(//mysql.innodb_buffer_pool_pages_total) > 0 ) |
MySQL | MySQL: Created tmp files on disk per second | How many temporary files mysqld has created. |
DEPENDENT | mysql.created_tmp_files.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Created tmp tables on disk per second | Number of internal on-disk temporary tables created by the server while executing statements. |
DEPENDENT | mysql.created_tmp_disk_tables.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Created tmp tables on memory per second | Number of internal temporary tables created by the server while executing statements. |
DEPENDENT | mysql.created_tmp_tables.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: InnoDB buffer pool pages free | The total size of the InnoDB buffer pool, in pages. |
DEPENDENT | mysql.innodb_buffer_pool_pages_free Preprocessing: - XMLPATH: |
MySQL | MySQL: InnoDB buffer pool pages total | The total size of the InnoDB buffer pool, in pages. |
DEPENDENT | mysql.innodb_buffer_pool_pages_total Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: InnoDB buffer pool read requests per second | Number of logical read requests per second. |
DEPENDENT | mysql.innodb_buffer_pool_read_requests.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: InnoDB buffer pool reads per second | Number of logical reads per second that InnoDB could not satisfy from the buffer pool, and had to read directly from the disk. |
DEPENDENT | mysql.innodb_buffer_pool_reads.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: InnoDB row lock time | The total time spent in acquiring row locks for InnoDB tables, in milliseconds. |
DEPENDENT | mysql.innodb_row_lock_time Preprocessing: - XMLPATH: - MULTIPLIER: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: InnoDB row lock time max | The maximum time to acquire a row lock for InnoDB tables, in milliseconds. |
DEPENDENT | mysql.innodb_row_lock_time_max Preprocessing: - XMLPATH: - MULTIPLIER: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: InnoDB row lock waits | Number of times operations on InnoDB tables had to wait for a row lock. |
DEPENDENT | mysql.innodb_row_lock_waits Preprocessing: - XMLPATH: |
MySQL | MySQL: Slow queries per second | Number of queries that have taken more than long_query_time seconds. |
DEPENDENT | mysql.slow_queries.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Bytes received | Number of bytes received from all clients. |
DEPENDENT | mysql.bytes_received.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Bytes sent | Number of bytes sent to all clients. |
DEPENDENT | mysql.bytes_sent.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Command Delete per second | The Com_delete counter variable indicates the number of times the delete statement has been executed. |
DEPENDENT | mysql.com_delete.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Command Insert per second | The Com_insert counter variable indicates the number of times the insert statement has been executed. |
DEPENDENT | mysql.com_insert.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Command Select per second | The Com_select counter variable indicates the number of times the select statement has been executed. |
DEPENDENT | mysql.com_select.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Command Update per second | The Com_update counter variable indicates the number of times the update statement has been executed. |
DEPENDENT | mysql.com_update.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Queries per second | Number of statements executed by the server. This variable includes statements executed within stored programs, unlike the Questions variable. |
DEPENDENT | mysql.queries.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Questions per second | Number of statements executed by the server. This includes only statements sent to the server by clients and not statements executed within stored programs, unlike the Queries variable. |
DEPENDENT | mysql.questions.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Binlog cache disk use | Number of transactions that used a temporary disk cache because they could not fit in the regular binary log cache, being larger than binlog_cache_size. |
DEPENDENT | mysql.binlog_cache_disk_use Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Innodb buffer pool wait free | Number of times InnoDB waited for a free page before reading or creating a page. Normally, writes to the InnoDB buffer pool happen in the background. When no clean pages are available, dirty pages are flushed first in order to free some up. This counts the numbers of wait for this operation to finish. If this value is not small, look at the increasing innodb_buffer_pool_size. |
DEPENDENT | mysql.innodb_buffer_pool_wait_free Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Innodb number open files | Number of open files held by InnoDB. InnoDB only. |
DEPENDENT | mysql.innodb_num_open_files Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Open table definitions | Number of cached table definitions. |
DEPENDENT | mysql.open_table_definitions Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Open tables | Number of tables that are open. |
DEPENDENT | mysql.open_tables Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Innodb log written | Number of bytes written to the InnoDB log. |
DEPENDENT | mysql.innodb_os_log_written Preprocessing: - XMLPATH: |
MySQL | MySQL: Calculated value of innodb_log_file_size | Calculated by (innodb_os_log_written-innodb_os_log_written(time shift -1h))/{$MYSQL.INNODB_LOG_FILES} value of the innodb_log_file_size. Innodb_log_file_size is the size in bytes of the each InnoDB redo log file in the log group. The combined size can be no more than 512GB. Larger values mean less disk I/O due to less flushing checkpoint activity, but also slower recovery from a crash. |
CALCULATED | mysql.innodb_log_file_size Preprocessing: - DISCARD_UNCHANGED_HEARTBEAT: Expression: (last(//mysql.innodb_os_log_written) - last(//mysql.innodb_os_log_written,#1:now-1h)) / {$MYSQL.INNODB_LOG_FILES} |
MySQL | MySQL: Size of database {#DBNAME} | - |
ZABBIX_PASSIVE | mysql.dbsize["{$MYSQL.HOST}","{$MYSQL.PORT}","{#DBNAME}"] Preprocessing: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Replication Slave SQL Running State {#MASTER_HOST} | This shows the state of the SQL driver threads. |
DEPENDENT | mysql.slave_sql_running_state["{#MASTER_HOST}"] Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Replication Seconds Behind Master {#MASTERHOST} | The number of seconds that the slave SQL thread is behind processing the master binary log. A high number (or an increasing one) can indicate that the slave is unable to handle events from the master in a timely fashion. |
DEPENDENT | mysql.seconds_behind_master["{#MASTERHOST}"] Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: - NOT_MATCHES_REGEX: ⛔️ON_FAIL: |
MySQL | MySQL: Replication Slave IO Running {#MASTERHOST} | Whether the I/O thread for reading the master's binary log is running. Normally, you want this to be Yes unless you have not yet started replication or have explicitly stopped it with STOP SLAVE. |
DEPENDENT | mysql.slave_io_running["{#MASTERHOST}"] Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Replication Slave SQL Running {#MASTERHOST} | Whether the SQL thread for executing events in the relay log is running. As with the I/O thread, this should normally be Yes. |
DEPENDENT | mysql.slave_sql_running["{#MASTERHOST}"] Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Binlog commits | Total number of transactions committed to the binary log. |
DEPENDENT | mysql.binlog_commits[{#SINGLETON}] Preprocessing: - XMLPATH: |
MySQL | MySQL: Binlog group commits | Total number of group commits done to the binary log. |
DEPENDENT | mysql.binlog_group_commits[{#SINGLETON}] Preprocessing: - XMLPATH: |
MySQL | MySQL: Master GTID wait count | The number of times MASTER_GTID_WAIT called. |
DEPENDENT | mysql.master_gtid_wait_count[{#SINGLETON}] Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Master GTID wait time | Total number of time spent in MASTER_GTID_WAIT. |
DEPENDENT | mysql.master_gtid_wait_time[{#SINGLETON}] Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Master GTID wait timeouts | Number of timeouts occurring in MASTER_GTID_WAIT. |
DEPENDENT | mysql.master_gtid_wait_timeouts[{#SINGLETON}] Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
Zabbix raw items | MySQL: Get status variables | The item gets server global status information. |
ZABBIX_PASSIVE | mysql.get_status_variables["{$MYSQL.HOST}","{$MYSQL.PORT}"] |
Zabbix raw items | MySQL: InnoDB buffer pool read requests | Number of logical read requests. |
DEPENDENT | mysql.innodb_buffer_pool_read_requests Preprocessing: - XMLPATH: |
Zabbix raw items | MySQL: InnoDB buffer pool reads | Number of logical reads that InnoDB could not satisfy from the buffer pool, and had to read directly from the disk. |
DEPENDENT | mysql.innodb_buffer_pool_reads Preprocessing: - XMLPATH: |
Zabbix raw items | MySQL: Replication Slave status {#MASTERHOST} | The item gets status information on the essential parameters of the slave threads. |
ZABBIX_PASSIVE | mysql.slave_status["{$MYSQL.HOST}","{$MYSQL.PORT}","{#MASTERHOST}"] |
Triggers
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
MySQL: Service is down | - |
last(/MySQL by Zabbix agent/mysql.ping["{$MYSQL.HOST}","{$MYSQL.PORT}"])=0 |
HIGH | |
MySQL: Version has changed | MySQL version has changed. Ack to close. |
last(/MySQL by Zabbix agent/mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"],#1)<>last(/MySQL by Zabbix agent/mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"],#2) and length(last(/MySQL by Zabbix agent/mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"]))>0 |
INFO | Manual close: YES |
MySQL: Service has been restarted | MySQL uptime is less than 10 minutes. |
last(/MySQL by Zabbix agent/mysql.uptime)<10m |
INFO | |
MySQL: Failed to fetch info data | Zabbix has not received data for items for the last 30 minutes. |
nodata(/MySQL by Zabbix agent/mysql.uptime,30m)=1 |
INFO | Depends on: - MySQL: Service is down |
MySQL: Server has aborted connections | The number of failed attempts to connect to the MySQL server is more than {$MYSQL.ABORTED_CONN.MAX.WARN} in the last 5 minutes. |
min(/MySQL by Zabbix agent/mysql.aborted_connects.rate,5m)>{$MYSQL.ABORTED_CONN.MAX.WARN} |
AVERAGE | Depends on: - MySQL: Refused connections |
MySQL: Refused connections | Number of refused connections due to the max_connections limit being reached. |
last(/MySQL by Zabbix agent/mysql.connection_errors_max_connections.rate)>0 |
AVERAGE | |
MySQL: Buffer pool utilization is too low | The buffer pool utilization is less than {$MYSQL.BUFF_UTIL.MIN.WARN}% in the last 5 minutes. This means that there is a lot of unused RAM allocated for the buffer pool, which you can easily reallocate at the moment. |
max(/MySQL by Zabbix agent/mysql.buffer_pool_utilization,5m)<{$MYSQL.BUFF_UTIL.MIN.WARN} |
WARNING | |
MySQL: Number of temporary files created per second is high | Possibly the application using the database is in need of query optimization. |
min(/MySQL by Zabbix agent/mysql.created_tmp_files.rate,5m)>{$MYSQL.CREATED_TMP_FILES.MAX.WARN} |
WARNING | |
MySQL: Number of on-disk temporary tables created per second is high | Possibly the application using the database is in need of query optimization. |
min(/MySQL by Zabbix agent/mysql.created_tmp_disk_tables.rate,5m)>{$MYSQL.CREATED_TMP_DISK_TABLES.MAX.WARN} |
WARNING | |
MySQL: Number of internal temporary tables created per second is high | Possibly the application using the database is in need of query optimization. |
min(/MySQL by Zabbix agent/mysql.created_tmp_tables.rate,5m)>{$MYSQL.CREATED_TMP_TABLES.MAX.WARN} |
WARNING | |
MySQL: Server has slow queries | The number of slow queries is more than {$MYSQL.SLOW_QUERIES.MAX.WARN} in the last 5 minutes. |
min(/MySQL by Zabbix agent/mysql.slow_queries.rate,5m)>{$MYSQL.SLOW_QUERIES.MAX.WARN} |
WARNING | |
MySQL: Replication lag is too high | - |
min(/MySQL by Zabbix agent/mysql.seconds_behind_master["{#MASTERHOST}"],5m)>{$MYSQL.REPL_LAG.MAX.WARN} |
WARNING | |
MySQL: The slave I/O thread is not running | Whether the I/O thread for reading the master's binary log is running. |
count(/MySQL by Zabbix agent/mysql.slave_io_running["{#MASTERHOST}"],#1,"eq","No")=1 |
AVERAGE | |
MySQL: The slave I/O thread is not connected to a replication master | - |
count(/MySQL by Zabbix agent/mysql.slave_io_running["{#MASTERHOST}"],#1,"ne","Yes")=1 |
WARNING | Depends on: - MySQL: The slave I/O thread is not running |
MySQL: The SQL thread is not running | Whether the SQL thread for executing events in the relay log is running. |
count(/MySQL by Zabbix agent/mysql.slave_sql_running["{#MASTERHOST}"],#1,"eq","No")=1 |
WARNING | Depends on: - MySQL: The slave I/O thread is not running |
Feedback
Please report any issues with the template at https://support.zabbix.com
You can also provide feedback, discuss the template or ask for help with it at ZABBIX forums.
Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/db/mysql_agent?at=release/6.0
MySQL by Zabbix agent
Overview
This template is designed for the effortless deployment of MySQL monitoring by Zabbix via Zabbix agent and doesn't require any external scripts.
Requirements
Zabbix version: 6.0 and higher.
Tested versions
This template has been tested on:
- MySQL 5.7, 8.0
- Percona 8.0
- MariaDB 10.4, 10.6.8
Configuration
Zabbix should be configured according to the instructions in the Templates out of the box section.
Setup
- Install Zabbix agent and MySQL client. If necessary, add the path to the
mysql
andmysqladmin
utilities to the global environment variable PATH. - 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. - 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
.
- Create
.my.cnf
configuration file in the home directory of Zabbix agent for Linux distributions (/var/lib/zabbix by default) ormy.cnf
in c:\ for Windows. For example:
[client]
protocol=tcp
user='zbx_monitor'
password='<password>'
For more information, please see MySQL documentation
.
NOTE: Linux distributions that use SELinux may require additional steps for access configuration.
For example, the following rule could be added to the SELinux policy:
# cat <<EOF > zabbix_home.te
module zabbix_home 1.0;
require {
type zabbix_agent_t;
type zabbix_var_lib_t;
type mysqld_etc_t;
type mysqld_port_t;
type mysqld_var_run_t;
class file { open read };
class tcp_socket name_connect;
class sock_file write;
}
#============= zabbix_agent_t ==============
allow zabbix_agent_t zabbix_var_lib_t:file read;
allow zabbix_agent_t zabbix_var_lib_t:file open;
allow zabbix_agent_t mysqld_etc_t:file read;
allow zabbix_agent_t mysqld_port_t:tcp_socket name_connect;
allow zabbix_agent_t mysqld_var_run_t:sock_file write;
EOF
# checkmodule -M -m -o zabbix_home.mod zabbix_home.te
# semodule_package -o zabbix_home.pp -m zabbix_home.mod
# semodule -i zabbix_home.pp
# restorecon -R /var/lib/zabbix
Macros used
Name | Description | Default |
---|---|---|
{$MYSQL.ABORTED_CONN.MAX.WARN} | Number of failed attempts to connect to the MySQL server for trigger expressions. |
3 |
{$MYSQL.HOST} | Hostname or IP of MySQL host or container. |
127.0.0.1 |
{$MYSQL.PORT} | MySQL service port. |
3306 |
{$MYSQL.REPL_LAG.MAX.WARN} | Amount of time the slave is behind the master for trigger expressions. |
30m |
{$MYSQL.SLOW_QUERIES.MAX.WARN} | Number of slow queries for trigger expressions. |
3 |
{$MYSQL.BUFF_UTIL.MIN.WARN} | The minimum buffer pool utilization in percentage for trigger expressions. |
50 |
{$MYSQL.CREATED_TMP_TABLES.MAX.WARN} | The maximum number of temporary tables created in memory per second for trigger expressions. |
30 |
{$MYSQL.CREATED_TMP_DISK_TABLES.MAX.WARN} | The maximum number of temporary tables created on a disk per second for trigger expressions. |
10 |
{$MYSQL.CREATED_TMP_FILES.MAX.WARN} | The maximum number of temporary files created on a disk per second for trigger expressions. |
10 |
{$MYSQL.INNODB_LOG_FILES} | Number of physical files in the InnoDB redo log for calculating |
2 |
{$MYSQL.DBNAME.MATCHES} | Filter of discoverable databases. |
.+ |
{$MYSQL.DBNAME.NOT_MATCHES} | Filter to exclude discovered databases. |
information_schema |
Items
Name | Description | Type | Key and additional info |
---|---|---|---|
MySQL: Get status variables | Gets server global status information. |
Zabbix agent | mysql.get_status_variables["{$MYSQL.HOST}","{$MYSQL.PORT}"] |
MySQL: Status | MySQL server status. |
Zabbix agent | mysql.ping["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing
|
MySQL: Version | MySQL server version. |
Zabbix agent | mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing
|
MySQL: Uptime | Number of seconds that the server has been up. |
Dependent item | mysql.uptime Preprocessing
|
MySQL: Aborted clients per second | Number of connections that were aborted because the client died without closing the connection properly. |
Dependent item | mysql.aborted_clients.rate Preprocessing
|
MySQL: Aborted connections per second | Number of failed attempts to connect to the MySQL server. |
Dependent item | mysql.aborted_connects.rate Preprocessing
|
MySQL: Connection errors accept per second | Number of errors that occurred during calls to |
Dependent item | mysql.connection_errors_accept.rate Preprocessing
|
MySQL: Connection errors internal per second | Number of refused connections due to internal server errors, for example, out of memory errors, or failed thread starts. |
Dependent item | mysql.connection_errors_internal.rate Preprocessing
|
MySQL: Connection errors max connections per second | Number of refused connections due to the |
Dependent item | mysql.connection_errors_max_connections.rate Preprocessing
|
MySQL: Connection errors peer address per second | Number of errors while searching for the connecting client's IP address. |
Dependent item | mysql.connection_errors_peer_address.rate Preprocessing
|
MySQL: Connection errors select per second | Number of errors during calls to |
Dependent item | mysql.connection_errors_select.rate Preprocessing
|
MySQL: Connection errors tcpwrap per second | Number of connections the libwrap library has refused. |
Dependent item | mysql.connection_errors_tcpwrap.rate Preprocessing
|
MySQL: Connections per second | Number of connection attempts (successful or not) to the MySQL server. |
Dependent item | mysql.connections.rate Preprocessing
|
MySQL: Max used connections | The maximum number of connections that have been in use simultaneously since the server start. |
Dependent item | mysql.max_used_connections Preprocessing
|
MySQL: Threads cached | Number of threads in the thread cache. |
Dependent item | mysql.threads_cached Preprocessing
|
MySQL: Threads connected | Number of currently open connections. |
Dependent item | mysql.threads_connected Preprocessing
|
MySQL: Threads created per second | Number of threads created to handle connections. If the value of |
Dependent item | mysql.threads_created.rate Preprocessing
|
MySQL: Threads running | Number of threads that are not sleeping. |
Dependent item | mysql.threads_running Preprocessing
|
MySQL: Buffer pool efficiency | The item shows how effectively the buffer pool is serving reads. |
Calculated | mysql.buffer_pool_efficiency |
MySQL: Buffer pool utilization | Ratio of used to total pages in the buffer pool. |
Calculated | mysql.buffer_pool_utilization |
MySQL: Created tmp files on disk per second | How many temporary files |
Dependent item | mysql.created_tmp_files.rate Preprocessing
|
MySQL: Created tmp tables on disk per second | Number of internal on-disk temporary tables created by the server while executing statements. |
Dependent item | mysql.created_tmp_disk_tables.rate Preprocessing
|
MySQL: Created tmp tables on memory per second | Number of internal temporary tables created by the server while executing statements. |
Dependent item | mysql.created_tmp_tables.rate Preprocessing
|
MySQL: InnoDB buffer pool pages free | The total size of the InnoDB buffer pool, in pages. |
Dependent item | mysql.innodb_buffer_pool_pages_free Preprocessing
|
MySQL: InnoDB buffer pool pages total | The total size of the InnoDB buffer pool, in pages. |
Dependent item | mysql.innodb_buffer_pool_pages_total Preprocessing
|
MySQL: InnoDB buffer pool read requests | Number of logical read requests. |
Dependent item | mysql.innodb_buffer_pool_read_requests Preprocessing
|
MySQL: InnoDB buffer pool read requests per second | Number of logical read requests per second. |
Dependent item | mysql.innodb_buffer_pool_read_requests.rate Preprocessing
|
MySQL: InnoDB buffer pool reads | Number of logical reads that InnoDB could not satisfy from the buffer pool and had to read directly from the disk. |
Dependent item | mysql.innodb_buffer_pool_reads Preprocessing
|
MySQL: InnoDB buffer pool reads per second | Number of logical reads per second that InnoDB could not satisfy from the buffer pool and had to read directly from the disk. |
Dependent item | mysql.innodb_buffer_pool_reads.rate Preprocessing
|
MySQL: InnoDB row lock time | The total time spent in acquiring row locks for InnoDB tables, in milliseconds. |
Dependent item | mysql.innodb_row_lock_time Preprocessing
|
MySQL: InnoDB row lock time max | The maximum time to acquire a row lock for InnoDB tables, in milliseconds. |
Dependent item | mysql.innodb_row_lock_time_max Preprocessing
|
MySQL: InnoDB row lock waits | Number of times operations on InnoDB tables had to wait for a row lock. |
Dependent item | mysql.innodb_row_lock_waits Preprocessing
|
MySQL: Slow queries per second | Number of queries that have taken more than |
Dependent item | mysql.slow_queries.rate Preprocessing
|
MySQL: Bytes received | Number of bytes received from all clients. |
Dependent item | mysql.bytes_received.rate Preprocessing
|
MySQL: Bytes sent | Number of bytes sent to all clients. |
Dependent item | mysql.bytes_sent.rate Preprocessing
|
MySQL: Command Delete per second | The |
Dependent item | mysql.com_delete.rate Preprocessing
|
MySQL: Command Insert per second | The |
Dependent item | mysql.com_insert.rate Preprocessing
|
MySQL: Command Select per second | The |
Dependent item | mysql.com_select.rate Preprocessing
|
MySQL: Command Update per second | The |
Dependent item | mysql.com_update.rate Preprocessing
|
MySQL: Queries per second | Number of statements executed by the server. This variable includes statements executed within stored programs, unlike the |
Dependent item | mysql.queries.rate Preprocessing
|
MySQL: Questions per second | Number of statements executed by the server. This includes only statements sent to the server by clients and not statements executed within stored programs, unlike the |
Dependent item | mysql.questions.rate Preprocessing
|
MySQL: Binlog cache disk use | Number of transactions that used a temporary disk cache because they could not fit in the regular binary log cache, being larger than |
Dependent item | mysql.binlog_cache_disk_use Preprocessing
|
MySQL: Innodb buffer pool wait free | Number of times InnoDB waited for a free page before reading or creating a page. Normally, writes to the InnoDB buffer pool happen in the background. When no clean pages are available, dirty pages are flushed first in order to free some up. This counts the numbers of wait for this operation to finish. If this value is not small, look at the increasing |
Dependent item | mysql.innodb_buffer_pool_wait_free Preprocessing
|
MySQL: Innodb number open files | Number of open files held by InnoDB. InnoDB only. |
Dependent item | mysql.innodb_num_open_files Preprocessing
|
MySQL: Open table definitions | Number of cached table definitions. |
Dependent item | mysql.open_table_definitions Preprocessing
|
MySQL: Open tables | Number of tables that are open. |
Dependent item | mysql.open_tables Preprocessing
|
MySQL: Innodb log written | Number of bytes written to the InnoDB log. |
Dependent item | mysql.innodb_os_log_written Preprocessing
|
MySQL: Calculated value of innodb_log_file_size |
|
Calculated | mysql.innodb_log_file_size Preprocessing
|
Triggers
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
MySQL: Service is down | MySQL is down. |
last(/MySQL by Zabbix agent/mysql.ping["{$MYSQL.HOST}","{$MYSQL.PORT}"])=0 |
High | |
MySQL: Version has changed | The MySQL version has changed. Acknowledge to close the problem manually. |
last(/MySQL by Zabbix agent/mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"],#1)<>last(/MySQL by Zabbix agent/mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"],#2) and length(last(/MySQL by Zabbix agent/mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"]))>0 |
Info | Manual close: Yes |
MySQL: Service has been restarted | MySQL uptime is less than 10 minutes. |
last(/MySQL by Zabbix agent/mysql.uptime)<10m |
Info | |
MySQL: Failed to fetch info data | Zabbix has not received any data for items for the last 30 minutes. |
nodata(/MySQL by Zabbix agent/mysql.uptime,30m)=1 |
Info | Depends on:
|
MySQL: Server has aborted connections | The number of failed attempts to connect to the MySQL server is more than |
min(/MySQL by Zabbix agent/mysql.aborted_connects.rate,5m)>{$MYSQL.ABORTED_CONN.MAX.WARN} |
Average | Depends on:
|
MySQL: Refused connections | Number of refused connections due to the |
last(/MySQL by Zabbix agent/mysql.connection_errors_max_connections.rate)>0 |
Average | |
MySQL: Buffer pool utilization is too low | The buffer pool utilization is less than |
max(/MySQL by Zabbix agent/mysql.buffer_pool_utilization,5m)<{$MYSQL.BUFF_UTIL.MIN.WARN} |
Warning | |
MySQL: Number of temporary files created per second is high | The application using the database may be in need of query optimization. |
min(/MySQL by Zabbix agent/mysql.created_tmp_files.rate,5m)>{$MYSQL.CREATED_TMP_FILES.MAX.WARN} |
Warning | |
MySQL: Number of on-disk temporary tables created per second is high | The application using the database may be in need of query optimization. |
min(/MySQL by Zabbix agent/mysql.created_tmp_disk_tables.rate,5m)>{$MYSQL.CREATED_TMP_DISK_TABLES.MAX.WARN} |
Warning | |
MySQL: Number of internal temporary tables created per second is high | The application using the database may be in need of query optimization. |
min(/MySQL by Zabbix agent/mysql.created_tmp_tables.rate,5m)>{$MYSQL.CREATED_TMP_TABLES.MAX.WARN} |
Warning | |
MySQL: Server has slow queries | The number of slow queries is more than |
min(/MySQL by Zabbix agent/mysql.slow_queries.rate,5m)>{$MYSQL.SLOW_QUERIES.MAX.WARN} |
Warning |
LLD rule Database discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
Database discovery | Scanning databases in DBMS. |
Zabbix agent | mysql.db.discovery["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing
|
Item prototypes for Database discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
MySQL: Size of database {#DBNAME} | Database size. |
Zabbix agent | mysql.dbsize["{$MYSQL.HOST}","{$MYSQL.PORT}","{#DBNAME}"] Preprocessing
|
LLD rule Replication discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
Replication discovery | If "show slave status" returns Master_Host, "Replication: *" items are created. |
Zabbix agent | mysql.replication.discovery["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing
|
Item prototypes for Replication discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
MySQL: Replication Slave status {#MASTER_HOST} | The item gets status information on the essential parameters of the slave threads. |
Zabbix agent | mysql.slave_status["{$MYSQL.HOST}","{$MYSQL.PORT}","{#MASTER_HOST}"] |
MySQL: Replication Slave SQL Running State {#MASTER_HOST} | This shows the state of the SQL driver threads. |
Dependent item | mysql.slave_sql_running_state["{#MASTER_HOST}"] Preprocessing
|
MySQL: Replication Seconds Behind Master {#MASTER_HOST} | The number of seconds that the slave SQL thread is behind processing the master binary log. A high number (or an increasing one) can indicate that the slave is unable to handle events from the master in a timely fashion. |
Dependent item | mysql.seconds_behind_master["{#MASTER_HOST}"] Preprocessing
|
MySQL: Replication Slave IO Running {#MASTER_HOST} | Whether the I/O thread for reading the master's binary log is running. Normally, you want this to be Yes unless you have not yet started replication or have explicitly stopped it with STOP SLAVE. |
Dependent item | mysql.slave_io_running["{#MASTER_HOST}"] Preprocessing
|
MySQL: Replication Slave SQL Running {#MASTER_HOST} | Whether the SQL thread for executing events in the relay log is running. As with the I/O thread, this should normally be Yes. |
Dependent item | mysql.slave_sql_running["{#MASTER_HOST}"] Preprocessing
|
Trigger prototypes for Replication discovery
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
MySQL: Replication lag is too high | Replication delay is too long. |
min(/MySQL by Zabbix agent/mysql.seconds_behind_master["{#MASTER_HOST}"],5m)>{$MYSQL.REPL_LAG.MAX.WARN} |
Warning | |
MySQL: The slave I/O thread is not running | Whether the I/O thread for reading the master's binary log is running. |
count(/MySQL by Zabbix agent/mysql.slave_io_running["{#MASTER_HOST}"],#1,"eq","No")=1 |
Average | |
MySQL: The slave I/O thread is not connected to a replication master | Whether the slave I/O thread is connected to the master. |
count(/MySQL by Zabbix agent/mysql.slave_io_running["{#MASTER_HOST}"],#1,"ne","Yes")=1 |
Warning | Depends on:
|
MySQL: The SQL thread is not running | Whether the SQL thread for executing events in the relay log is running. |
count(/MySQL by Zabbix agent/mysql.slave_sql_running["{#MASTER_HOST}"],#1,"eq","No")=1 |
Warning | Depends on:
|
LLD rule MariaDB discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
MariaDB discovery | Used for additional metrics if MariaDB is used. |
Dependent item | mysql.extra_metric.discovery Preprocessing
|
Item prototypes for MariaDB discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
MySQL: Binlog commits | Total number of transactions committed to the binary log. |
Dependent item | mysql.binlog_commits[{#SINGLETON}] Preprocessing
|
MySQL: Binlog group commits | Total number of group commits done to the binary log. |
Dependent item | mysql.binlog_group_commits[{#SINGLETON}] Preprocessing
|
MySQL: Master GTID wait count | The number of times |
Dependent item | mysql.master_gtid_wait_count[{#SINGLETON}] Preprocessing
|
MySQL: Master GTID wait time | Total number of time spent in |
Dependent item | mysql.master_gtid_wait_time[{#SINGLETON}] Preprocessing
|
MySQL: Master GTID wait timeouts | Number of timeouts occurring in |
Dependent item | mysql.master_gtid_wait_timeouts[{#SINGLETON}] Preprocessing
|
Feedback
Please report any issues with the template at https://support.zabbix.com
You can also provide feedback, discuss the template, or ask for help at ZABBIX forums
Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/db/mysql_agent?at=release/5.4
MySQL by Zabbix agent
Overview
For Zabbix version: 5.4 and higher
The template is developed for monitoring DBMS MySQL and its forks.
This template was tested on:
- MySQL, version 5.7, 8.0
- Percona, version 8.0
- MariaDB, version 10.4
Setup
See Zabbix template operation for basic instructions.
- Install Zabbix agent and MySQL client. If necessary, add the path to the
mysql
andmysqladmin
utilities to the global environment variable PATH. - Copy
template_db_mysql.conf
into the folder with Zabbix agent configuration (/etc/zabbix/zabbix_agentd.d/
by default). Don't forget to restart Zabbix agent. - Create a MySQL user for monitoring (
<password>
at your discretion):
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
- Create
.my.cnf
in the home directory of Zabbix agent for Linux (/var/lib/zabbix
by default ) ormy.cnf
in c:\ for Windows. The file must have three strings:
[client]
user='zbx_monitor'
password='<password>'
NOTE: Use systemd to start Zabbix agent on Linux OS. For example, in Centos use "systemctl edit zabbix-agent.service" to set the required user to start the Zabbix agent.
Add the rule to the SELinux policy (example for Centos):
# cat <<EOF > zabbix_home.te
module zabbix_home 1.0;
require {
type zabbix_agent_t;
type zabbix_var_lib_t;
type mysqld_etc_t;
type mysqld_port_t;
type mysqld_var_run_t;
class file { open read };
class tcp_socket name_connect;
class sock_file write;
}
#============= zabbix_agent_t ==============
allow zabbix_agent_t zabbix_var_lib_t:file read;
allow zabbix_agent_t zabbix_var_lib_t:file open;
allow zabbix_agent_t mysqld_etc_t:file read;
allow zabbix_agent_t mysqld_port_t:tcp_socket name_connect;
allow zabbix_agent_t mysqld_var_run_t:sock_file write;
EOF
# checkmodule -M -m -o zabbix_home.mod zabbix_home.te
# semodule_package -o zabbix_home.pp -m zabbix_home.mod
# semodule -i zabbix_home.pp
# restorecon -R /var/lib/zabbix
Zabbix configuration
No specific Zabbix configuration is required.
Macros used
Name | Description | Default |
---|---|---|
{$MYSQL.ABORTED_CONN.MAX.WARN} | The number of failed attempts to connect to the MySQL server for trigger expression. |
3 |
{$MYSQL.BUFF_UTIL.MIN.WARN} | The minimum buffer pool utilization in percentage for trigger expression. |
50 |
{$MYSQL.CREATED_TMP_DISK_TABLES.MAX.WARN} | The maximum number of created tmp tables on a disk per second for trigger expressions. |
10 |
{$MYSQL.CREATED_TMP_FILES.MAX.WARN} | The maximum number of created tmp files on a disk per second for trigger expressions. |
10 |
{$MYSQL.CREATED_TMP_TABLES.MAX.WARN} | The maximum number of created tmp tables in memory per second for trigger expressions. |
30 |
{$MYSQL.HOST} | Hostname or IP of MySQL host or container. |
localhost |
{$MYSQL.INNODB_LOG_FILES} | Number of physical files in the InnoDB redo log for calculating innodb_log_file_size. |
2 |
{$MYSQL.PORT} | MySQL service port. |
3306 |
{$MYSQL.REPL_LAG.MAX.WARN} | The lag of slave from master for trigger expression. |
30m |
{$MYSQL.SLOW_QUERIES.MAX.WARN} | The number of slow queries for trigger expression. |
3 |
Template links
There are no template links in this template.
Discovery rules
Name | Description | Type | Key and additional info |
---|---|---|---|
Database discovery | Scanning databases in DBMS. |
ZABBIX_PASSIVE | mysql.db.discovery["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing: - JAVASCRIPT: - DISCARD_UNCHANGED_HEARTBEAT: Filter: AND_OR- {#DBNAME} NOT_MATCHES_REGEX |
Replication discovery | If "show slave status" returns Master_Host, "Replication: *" items are created. |
ZABBIX_PASSIVE | mysql.replication.discovery["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing: - JAVASCRIPT: - DISCARD_UNCHANGED_HEARTBEAT: |
MariaDB discovery | Additional metrics if MariaDB is used. |
DEPENDENT | mysql.extra_metric.discovery Preprocessing: - JAVASCRIPT: |
Items collected
Group | Name | Description | Type | Key and additional info |
---|---|---|---|---|
MySQL | MySQL: Status | ZABBIX_PASSIVE | mysql.ping["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing: - JAVASCRIPT: - DISCARD_UNCHANGED_HEARTBEAT: |
|
MySQL | MySQL: Version | ZABBIX_PASSIVE | mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing: - REGEX: - DISCARD_UNCHANGED_HEARTBEAT: |
|
MySQL | MySQL: Uptime | The amount of seconds that the server has been up. |
DEPENDENT | mysql.uptime Preprocessing: - XMLPATH: |
MySQL | MySQL: Aborted clients per second | Number of connections that were aborted because the client died without closing the connection properly. |
DEPENDENT | mysql.aborted_clients.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Aborted connections per second | Number of failed attempts to connect to the MySQL server. |
DEPENDENT | mysql.aborted_connects.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Connection errors accept per second | Number of errors that occurred during calls to accept() on the listening port. |
DEPENDENT | mysql.connection_errors_accept.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Connection errors internal per second | Number of refused connections due to internal server errors, for example, out of memory errors, or failed thread starts. |
DEPENDENT | mysql.connection_errors_internal.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Connection errors max connections per second | Number of refused connections due to the max_connections limit being reached. |
DEPENDENT | mysql.connection_errors_max_connections.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Connection errors peer address per second | Number of errors while searching for the connecting client IP address. |
DEPENDENT | mysql.connection_errors_peer_address.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Connection errors select per second | Number of errors during calls to select() or poll() on the listening port. The client would not necessarily have been rejected in these cases. |
DEPENDENT | mysql.connection_errors_select.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Connection errors tcpwrap per second | Number of connections the libwrap library has refused. |
DEPENDENT | mysql.connection_errors_tcpwrap.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Connections per second | Number of connection attempts (successful or not) to the MySQL server. |
DEPENDENT | mysql.connections.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Max used connections | The maximum number of connections that have been in use simultaneously since the server start. |
DEPENDENT | mysql.max_used_connections Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Threads cached | Number of threads in the thread cache. |
DEPENDENT | mysql.threads_cached Preprocessing: - XMLPATH: |
MySQL | MySQL: Threads connected | Number of currently open connections. |
DEPENDENT | mysql.threads_connected Preprocessing: - XMLPATH: |
MySQL | MySQL: Threads created per second | Number of threads created to handle connections. If Threads_created is big, you may want to increase the thread_cache_size value. The cache miss rate can be calculated as Threads_created/Connections. |
DEPENDENT | mysql.threads_created.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Threads running | Number of threads which are not sleeping. |
DEPENDENT | mysql.threads_running Preprocessing: - XMLPATH: |
MySQL | MySQL: Buffer pool efficiency | The item shows how effectively the buffer pool is serving reads. |
CALCULATED | mysql.buffer_pool_efficiency Expression: last(//mysql.innodb_buffer_pool_reads) / ( last(//mysql.innodb_buffer_pool_read_requests) + ( last(//mysql.innodb_buffer_pool_read_requests) = 0 ) ) * 100 * ( last(//mysql.innodb_buffer_pool_read_requests) > 0 ) |
MySQL | MySQL: Buffer pool utilization | Ratio of used to total pages in the buffer pool. |
CALCULATED | mysql.buffer_pool_utilization Expression: ( last(//mysql.innodb_buffer_pool_pages_total) - last(//mysql.innodb_buffer_pool_pages_free) ) / ( last(//mysql.innodb_buffer_pool_pages_total) + ( last(//mysql.innodb_buffer_pool_pages_total) = 0 ) ) * 100 * ( last(//mysql.innodb_buffer_pool_pages_total) > 0 ) |
MySQL | MySQL: Created tmp files on disk per second | How many temporary files mysqld has created. |
DEPENDENT | mysql.created_tmp_files.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Created tmp tables on disk per second | Number of internal on-disk temporary tables created by the server while executing statements. |
DEPENDENT | mysql.created_tmp_disk_tables.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Created tmp tables on memory per second | Number of internal temporary tables created by the server while executing statements. |
DEPENDENT | mysql.created_tmp_tables.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: InnoDB buffer pool pages free | The total size of the InnoDB buffer pool, in pages. |
DEPENDENT | mysql.innodb_buffer_pool_pages_free Preprocessing: - XMLPATH: |
MySQL | MySQL: InnoDB buffer pool pages total | The total size of the InnoDB buffer pool, in pages. |
DEPENDENT | mysql.innodb_buffer_pool_pages_total Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: InnoDB buffer pool read requests per second | Number of logical read requests per second. |
DEPENDENT | mysql.innodb_buffer_pool_read_requests.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: InnoDB buffer pool reads per second | Number of logical reads per second that InnoDB could not satisfy from the buffer pool, and had to read directly from the disk. |
DEPENDENT | mysql.innodb_buffer_pool_reads.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: InnoDB row lock time | The total time spent in acquiring row locks for InnoDB tables, in milliseconds. |
DEPENDENT | mysql.innodb_row_lock_time Preprocessing: - XMLPATH: - MULTIPLIER: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: InnoDB row lock time max | The maximum time to acquire a row lock for InnoDB tables, in milliseconds. |
DEPENDENT | mysql.innodb_row_lock_time_max Preprocessing: - XMLPATH: - MULTIPLIER: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: InnoDB row lock waits | Number of times operations on InnoDB tables had to wait for a row lock. |
DEPENDENT | mysql.innodb_row_lock_waits Preprocessing: - XMLPATH: |
MySQL | MySQL: Slow queries per second | Number of queries that have taken more than long_query_time seconds. |
DEPENDENT | mysql.slow_queries.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Bytes received | Number of bytes received from all clients. |
DEPENDENT | mysql.bytes_received.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Bytes sent | Number of bytes sent to all clients. |
DEPENDENT | mysql.bytes_sent.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Command Delete per second | The Com_delete counter variable indicates the number of times the delete statement has been executed. |
DEPENDENT | mysql.com_delete.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Command Insert per second | The Com_insert counter variable indicates the number of times the insert statement has been executed. |
DEPENDENT | mysql.com_insert.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Command Select per second | The Com_select counter variable indicates the number of times the select statement has been executed. |
DEPENDENT | mysql.com_select.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Command Update per second | The Com_update counter variable indicates the number of times the update statement has been executed. |
DEPENDENT | mysql.com_update.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Queries per second | Number of statements executed by the server. This variable includes statements executed within stored programs, unlike the Questions variable. |
DEPENDENT | mysql.queries.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Questions per second | Number of statements executed by the server. This includes only statements sent to the server by clients and not statements executed within stored programs, unlike the Queries variable. |
DEPENDENT | mysql.questions.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Binlog cache disk use | Number of transactions that used a temporary disk cache because they could not fit in the regular binary log cache, being larger than binlog_cache_size. |
DEPENDENT | mysql.binlog_cache_disk_use Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Innodb buffer pool wait free | Number of times InnoDB waited for a free page before reading or creating a page. Normally, writes to the InnoDB buffer pool happen in the background. When no clean pages are available, dirty pages are flushed first in order to free some up. This counts the numbers of wait for this operation to finish. If this value is not small, look at the increasing innodb_buffer_pool_size. |
DEPENDENT | mysql.innodb_buffer_pool_wait_free Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Innodb number open files | Number of open files held by InnoDB. InnoDB only. |
DEPENDENT | mysql.innodb_num_open_files Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Open table definitions | Number of cached table definitions. |
DEPENDENT | mysql.open_table_definitions Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Open tables | Number of tables that are open. |
DEPENDENT | mysql.open_tables Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Innodb log written | Number of bytes written to the InnoDB log. |
DEPENDENT | mysql.innodb_os_log_written Preprocessing: - XMLPATH: |
MySQL | MySQL: Calculated value of innodb_log_file_size | Calculated by (innodb_os_log_written-innodb_os_log_written(time shift -1h))/{$MYSQL.INNODB_LOG_FILES} value of the innodb_log_file_size. Innodb_log_file_size is the size in bytes of the each InnoDB redo log file in the log group. The combined size can be no more than 512GB. Larger values mean less disk I/O due to less flushing checkpoint activity, but also slower recovery from a crash. |
CALCULATED | mysql.innodb_log_file_size Preprocessing: - DISCARD_UNCHANGED_HEARTBEAT: Expression: (last(//mysql.innodb_os_log_written) - last(//mysql.innodb_os_log_written,#1:now-1h)) / {$MYSQL.INNODB_LOG_FILES} |
MySQL | MySQL: Size of database {#DBNAME} | - |
ZABBIX_PASSIVE | mysql.dbsize["{$MYSQL.HOST}","{$MYSQL.PORT}","{#DBNAME}"] Preprocessing: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Replication Slave SQL Running State {#MASTER_HOST} | This shows the state of the SQL driver threads. |
DEPENDENT | mysql.slave_sql_running_state["{#MASTER_HOST}"] Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Replication Seconds Behind Master {#MASTERHOST} | The number of seconds that the slave SQL thread is behind processing the master binary log. A high number (or an increasing one) can indicate that the slave is unable to handle events from the master in a timely fashion. |
DEPENDENT | mysql.seconds_behind_master["{#MASTERHOST}"] Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: - NOT_MATCHES_REGEX: ⛔️ON_FAIL: |
MySQL | MySQL: Replication Slave IO Running {#MASTERHOST} | Whether the I/O thread for reading the master's binary log is running. Normally, you want this to be Yes unless you have not yet started replication or have explicitly stopped it with STOP SLAVE. |
DEPENDENT | mysql.slave_io_running["{#MASTERHOST}"] Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Replication Slave SQL Running {#MASTERHOST} | Whether the SQL thread for executing events in the relay log is running. As with the I/O thread, this should normally be Yes. |
DEPENDENT | mysql.slave_sql_running["{#MASTERHOST}"] Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Binlog commits | Total number of transactions committed to the binary log. |
DEPENDENT | mysql.binlog_commits[{#SINGLETON}] Preprocessing: - XMLPATH: |
MySQL | MySQL: Binlog group commits | Total number of group commits done to the binary log. |
DEPENDENT | mysql.binlog_group_commits[{#SINGLETON}] Preprocessing: - XMLPATH: |
MySQL | MySQL: Master GTID wait count | The number of times MASTER_GTID_WAIT called. |
DEPENDENT | mysql.master_gtid_wait_count[{#SINGLETON}] Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Master GTID wait time | Total number of time spent in MASTER_GTID_WAIT. |
DEPENDENT | mysql.master_gtid_wait_time[{#SINGLETON}] Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Master GTID wait timeouts | Number of timeouts occurring in MASTER_GTID_WAIT. |
DEPENDENT | mysql.master_gtid_wait_timeouts[{#SINGLETON}] Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
Zabbix_raw_items | MySQL: Get status variables | The item gets server global status information. |
ZABBIX_PASSIVE | mysql.get_status_variables["{$MYSQL.HOST}","{$MYSQL.PORT}"] |
Zabbix_raw_items | MySQL: InnoDB buffer pool read requests | Number of logical read requests. |
DEPENDENT | mysql.innodb_buffer_pool_read_requests Preprocessing: - XMLPATH: |
Zabbix_raw_items | MySQL: InnoDB buffer pool reads | Number of logical reads that InnoDB could not satisfy from the buffer pool, and had to read directly from the disk. |
DEPENDENT | mysql.innodb_buffer_pool_reads Preprocessing: - XMLPATH: |
Zabbix_raw_items | MySQL: Replication Slave status {#MASTERHOST} | The item gets status information on the essential parameters of the slave threads. |
ZABBIX_PASSIVE | mysql.slave_status["{$MYSQL.HOST}","{$MYSQL.PORT}","{#MASTERHOST}"] |
Triggers
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
MySQL: Service is down | - |
last(/MySQL by Zabbix agent/mysql.ping["{$MYSQL.HOST}","{$MYSQL.PORT}"])=0 |
HIGH | |
MySQL: Version has changed (new version value received: {ITEM.VALUE}) | MySQL version has changed. Ack to close. |
last(/MySQL by Zabbix agent/mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"],#1)<>last(/MySQL by Zabbix agent/mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"],#2) and length(last(/MySQL by Zabbix agent/mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"]))>0 |
INFO | Manual close: YES |
MySQL: Service has been restarted (uptime < 10m) | MySQL uptime is less than 10 minutes. |
last(/MySQL by Zabbix agent/mysql.uptime)<10m |
INFO | |
MySQL: Failed to fetch info data (or no data for 30m) | Zabbix has not received data for items for the last 30 minutes. |
nodata(/MySQL by Zabbix agent/mysql.uptime,30m)=1 |
INFO | Depends on: - MySQL: Service is down |
MySQL: Server has aborted connections (over {$MYSQL.ABORTED_CONN.MAX.WARN} for 5m) | The number of failed attempts to connect to the MySQL server is more than {$MYSQL.ABORTED_CONN.MAX.WARN} in the last 5 minutes. |
min(/MySQL by Zabbix agent/mysql.aborted_connects.rate,5m)>{$MYSQL.ABORTED_CONN.MAX.WARN} |
AVERAGE | Depends on: - MySQL: Refused connections (max_connections limit reached) |
MySQL: Refused connections (max_connections limit reached) | Number of refused connections due to the max_connections limit being reached. |
last(/MySQL by Zabbix agent/mysql.connection_errors_max_connections.rate)>0 |
AVERAGE | |
MySQL: Buffer pool utilization is too low (less than {$MYSQL.BUFF_UTIL.MIN.WARN}% for 5m) | The buffer pool utilization is less than {$MYSQL.BUFF_UTIL.MIN.WARN}% in the last 5 minutes. This means that there is a lot of unused RAM allocated for the buffer pool, which you can easily reallocate at the moment. |
max(/MySQL by Zabbix agent/mysql.buffer_pool_utilization,5m)<{$MYSQL.BUFF_UTIL.MIN.WARN} |
WARNING | |
MySQL: Number of temporary files created per second is high (over {$MYSQL.CREATED_TMP_FILES.MAX.WARN} for 5m) | Possibly the application using the database is in need of query optimization. |
min(/MySQL by Zabbix agent/mysql.created_tmp_files.rate,5m)>{$MYSQL.CREATED_TMP_FILES.MAX.WARN} |
WARNING | |
MySQL: Number of on-disk temporary tables created per second is high (over {$MYSQL.CREATED_TMP_DISK_TABLES.MAX.WARN} for 5m) | Possibly the application using the database is in need of query optimization. |
min(/MySQL by Zabbix agent/mysql.created_tmp_disk_tables.rate,5m)>{$MYSQL.CREATED_TMP_DISK_TABLES.MAX.WARN} |
WARNING | |
MySQL: Number of internal temporary tables created per second is high (over {$MYSQL.CREATED_TMP_TABLES.MAX.WARN} for 5m) | Possibly the application using the database is in need of query optimization. |
min(/MySQL by Zabbix agent/mysql.created_tmp_tables.rate,5m)>{$MYSQL.CREATED_TMP_TABLES.MAX.WARN} |
WARNING | |
MySQL: Server has slow queries (over {$MYSQL.SLOW_QUERIES.MAX.WARN} for 5m) | The number of slow queries is more than {$MYSQL.SLOW_QUERIES.MAX.WARN} in the last 5 minutes. |
min(/MySQL by Zabbix agent/mysql.slow_queries.rate,5m)>{$MYSQL.SLOW_QUERIES.MAX.WARN} |
WARNING | |
MySQL: Replication lag is too high (over {$MYSQL.REPL_LAG.MAX.WARN} for 5m) | - |
min(/MySQL by Zabbix agent/mysql.seconds_behind_master["{#MASTERHOST}"],5m)>{$MYSQL.REPL_LAG.MAX.WARN} |
WARNING | |
MySQL: The slave I/O thread is not running | Whether the I/O thread for reading the master's binary log is running. |
count(/MySQL by Zabbix agent/mysql.slave_io_running["{#MASTERHOST}"],#1,"eq","No")=1 |
AVERAGE | |
MySQL: The slave I/O thread is not connected to a replication master | - |
count(/MySQL by Zabbix agent/mysql.slave_io_running["{#MASTERHOST}"],#1,"ne","Yes")=1 |
WARNING | Depends on: - MySQL: The slave I/O thread is not running |
MySQL: The SQL thread is not running | Whether the SQL thread for executing events in the relay log is running. |
count(/MySQL by Zabbix agent/mysql.slave_sql_running["{#MASTERHOST}"],#1,"eq","No")=1 |
WARNING | Depends on: - MySQL: The slave I/O thread is not running |
Feedback
Please report any issues with the template at https://support.zabbix.com
You can also provide a feedback, discuss the template or ask for help with it at ZABBIX forums.
Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/db/mysql_agent?at=release/5.0
Template DB MySQL by Zabbix agent
Overview
For Zabbix version: 5.0 and higher
The template is developed for monitoring DBMS MySQL and its forks.
This template was tested on:
- MySQL, version 5.7, 8.0
- Percona, version 8.0
- MariaDB, version 10.4, 10.6.8
Setup
See Zabbix template operation for basic instructions.
- Install Zabbix agent and MySQL client. If necessary, add the path to the
mysql
andmysqladmin
utilities to the global environment variable PATH. - Copy
template_db_mysql.conf
into the folder with Zabbix agent configuration (/etc/zabbix/zabbix_agentd.d/
by default). Don't forget to restart Zabbix agent. - Create a MySQL user for monitoring (
<password>
at your discretion):
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
- Create
.my.cnf
in the home directory of Zabbix agent for Linux (/var/lib/zabbix
by default ) ormy.cnf
in c:\ for Windows. The file must have three strings:
[client]
user='zbx_monitor'
password='<password>'
NOTE: Use systemd to start Zabbix agent on Linux OS. For example, in Centos use "systemctl edit zabbix-agent.service" to set the required user to start the Zabbix agent.
Add the rule to the SELinux policy (example for Centos):
# cat <<EOF > zabbix_home.te
module zabbix_home 1.0;
require {
type zabbix_agent_t;
type zabbix_var_lib_t;
type mysqld_etc_t;
type mysqld_port_t;
type mysqld_var_run_t;
class file { open read };
class tcp_socket name_connect;
class sock_file write;
}
#============= zabbix_agent_t ==============
allow zabbix_agent_t zabbix_var_lib_t:file read;
allow zabbix_agent_t zabbix_var_lib_t:file open;
allow zabbix_agent_t mysqld_etc_t:file read;
allow zabbix_agent_t mysqld_port_t:tcp_socket name_connect;
allow zabbix_agent_t mysqld_var_run_t:sock_file write;
EOF
# checkmodule -M -m -o zabbix_home.mod zabbix_home.te
# semodule_package -o zabbix_home.pp -m zabbix_home.mod
# semodule -i zabbix_home.pp
# restorecon -R /var/lib/zabbix
Zabbix configuration
No specific Zabbix configuration is required.
Macros used
Name | Description | Default |
---|---|---|
{$MYSQL.ABORTED_CONN.MAX.WARN} | The number of failed attempts to connect to the MySQL server for trigger expression. |
3 |
{$MYSQL.BUFF_UTIL.MIN.WARN} | The minimum buffer pool utilization in percentage for trigger expression. |
50 |
{$MYSQL.CREATED_TMP_DISK_TABLES.MAX.WARN} | The maximum number of created tmp tables on a disk per second for trigger expressions. |
10 |
{$MYSQL.CREATED_TMP_FILES.MAX.WARN} | The maximum number of created tmp files on a disk per second for trigger expressions. |
10 |
{$MYSQL.CREATED_TMP_TABLES.MAX.WARN} | The maximum number of created tmp tables in memory per second for trigger expressions. |
30 |
{$MYSQL.HOST} | Hostname or IP of MySQL host or container. |
127.0.0.1 |
{$MYSQL.INNODB_LOG_FILES} | Number of physical files in the InnoDB redo log for calculating innodb_log_file_size. |
2 |
{$MYSQL.PORT} | MySQL service port. |
3306 |
{$MYSQL.REPL_LAG.MAX.WARN} | The lag of slave from master for trigger expression. |
30m |
{$MYSQL.SLOW_QUERIES.MAX.WARN} | The number of slow queries for trigger expression. |
3 |
Template links
There are no template links in this template.
Discovery rules
Name | Description | Type | Key and additional info |
---|---|---|---|
Database discovery | Scanning databases in DBMS. |
ZABBIX_PASSIVE | mysql.db.discovery["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing: - JAVASCRIPT: - DISCARD_UNCHANGED_HEARTBEAT: Filter: AND_OR- A: {#DBNAME} NOT_MATCHES_REGEX |
Replication discovery | If "show slave status" returns Master_Host, "Replication: *" items are created. |
ZABBIX_PASSIVE | mysql.replication.discovery["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing: - JAVASCRIPT: - DISCARD_UNCHANGED_HEARTBEAT: |
MariaDB discovery | Additional metrics if MariaDB is used. |
DEPENDENT | mysql.extra_metric.discovery Preprocessing: - JAVASCRIPT: |
Items collected
Group | Name | Description | Type | Key and additional info |
---|---|---|---|---|
MySQL | MySQL: Status | ZABBIX_PASSIVE | mysql.ping["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing: - JAVASCRIPT: - DISCARD_UNCHANGED_HEARTBEAT: |
|
MySQL | MySQL: Version | ZABBIX_PASSIVE | mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"] Preprocessing: - REGEX: - DISCARD_UNCHANGED_HEARTBEAT: |
|
MySQL | MySQL: Uptime | The amount of seconds that the server has been up. |
DEPENDENT | mysql.uptime Preprocessing: - XMLPATH: |
MySQL | MySQL: Aborted clients per second | Number of connections that were aborted because the client died without closing the connection properly. |
DEPENDENT | mysql.aborted_clients.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Aborted connections per second | Number of failed attempts to connect to the MySQL server. |
DEPENDENT | mysql.aborted_connects.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Connection errors accept per second | Number of errors that occurred during calls to accept() on the listening port. |
DEPENDENT | mysql.connection_errors_accept.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Connection errors internal per second | Number of refused connections due to internal server errors, for example, out of memory errors, or failed thread starts. |
DEPENDENT | mysql.connection_errors_internal.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Connection errors max connections per second | Number of refused connections due to the max_connections limit being reached. |
DEPENDENT | mysql.connection_errors_max_connections.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Connection errors peer address per second | Number of errors while searching for the connecting client IP address. |
DEPENDENT | mysql.connection_errors_peer_address.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Connection errors select per second | Number of errors during calls to select() or poll() on the listening port. The client would not necessarily have been rejected in these cases. |
DEPENDENT | mysql.connection_errors_select.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Connection errors tcpwrap per second | Number of connections the libwrap library has refused. |
DEPENDENT | mysql.connection_errors_tcpwrap.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Connections per second | Number of connection attempts (successful or not) to the MySQL server. |
DEPENDENT | mysql.connections.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Max used connections | The maximum number of connections that have been in use simultaneously since the server start. |
DEPENDENT | mysql.max_used_connections Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Threads cached | Number of threads in the thread cache. |
DEPENDENT | mysql.threads_cached Preprocessing: - XMLPATH: |
MySQL | MySQL: Threads connected | Number of currently open connections. |
DEPENDENT | mysql.threads_connected Preprocessing: - XMLPATH: |
MySQL | MySQL: Threads created per second | Number of threads created to handle connections. If Threads_created is big, you may want to increase the thread_cache_size value. The cache miss rate can be calculated as Threads_created/Connections. |
DEPENDENT | mysql.threads_created.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Threads running | Number of threads which are not sleeping. |
DEPENDENT | mysql.threads_running Preprocessing: - XMLPATH: |
MySQL | MySQL: Buffer pool efficiency | The item shows how effectively the buffer pool is serving reads. |
CALCULATED | mysql.buffer_pool_efficiency Expression: last(mysql.innodb_buffer_pool_reads) / ( last(mysql.innodb_buffer_pool_read_requests) + ( last(mysql.innodb_buffer_pool_read_requests) = 0 ) ) * 100 * ( last(mysql.innodb_buffer_pool_read_requests) > 0 ) |
MySQL | MySQL: Buffer pool utilization | Ratio of used to total pages in the buffer pool. |
CALCULATED | mysql.buffer_pool_utilization Expression: ( last(mysql.innodb_buffer_pool_pages_total) - last(mysql.innodb_buffer_pool_pages_free) ) / ( last(mysql.innodb_buffer_pool_pages_total) + ( last(mysql.innodb_buffer_pool_pages_total) = 0 ) ) * 100 * ( last(mysql.innodb_buffer_pool_pages_total) > 0 ) |
MySQL | MySQL: Created tmp files on disk per second | How many temporary files mysqld has created. |
DEPENDENT | mysql.created_tmp_files.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Created tmp tables on disk per second | Number of internal on-disk temporary tables created by the server while executing statements. |
DEPENDENT | mysql.created_tmp_disk_tables.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Created tmp tables on memory per second | Number of internal temporary tables created by the server while executing statements. |
DEPENDENT | mysql.created_tmp_tables.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: InnoDB buffer pool pages free | The total size of the InnoDB buffer pool, in pages. |
DEPENDENT | mysql.innodb_buffer_pool_pages_free Preprocessing: - XMLPATH: |
MySQL | MySQL: InnoDB buffer pool pages total | The total size of the InnoDB buffer pool, in pages. |
DEPENDENT | mysql.innodb_buffer_pool_pages_total Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: InnoDB buffer pool read requests per second | Number of logical read requests per second. |
DEPENDENT | mysql.innodb_buffer_pool_read_requests.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: InnoDB buffer pool reads per second | Number of logical reads per second that InnoDB could not satisfy from the buffer pool, and had to read directly from the disk. |
DEPENDENT | mysql.innodb_buffer_pool_reads.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: InnoDB row lock time | The total time spent in acquiring row locks for InnoDB tables, in milliseconds. |
DEPENDENT | mysql.innodb_row_lock_time Preprocessing: - XMLPATH: - MULTIPLIER: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: InnoDB row lock time max | The maximum time to acquire a row lock for InnoDB tables, in milliseconds. |
DEPENDENT | mysql.innodb_row_lock_time_max Preprocessing: - XMLPATH: - MULTIPLIER: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: InnoDB row lock waits | Number of times operations on InnoDB tables had to wait for a row lock. |
DEPENDENT | mysql.innodb_row_lock_waits Preprocessing: - XMLPATH: |
MySQL | MySQL: Slow queries per second | Number of queries that have taken more than long_query_time seconds. |
DEPENDENT | mysql.slow_queries.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Bytes received | Number of bytes received from all clients. |
DEPENDENT | mysql.bytes_received.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Bytes sent | Number of bytes sent to all clients. |
DEPENDENT | mysql.bytes_sent.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Command Delete per second | The Com_delete counter variable indicates the number of times the delete statement has been executed. |
DEPENDENT | mysql.com_delete.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Command Insert per second | The Com_insert counter variable indicates the number of times the insert statement has been executed. |
DEPENDENT | mysql.com_insert.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Command Select per second | The Com_select counter variable indicates the number of times the select statement has been executed. |
DEPENDENT | mysql.com_select.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Command Update per second | The Com_update counter variable indicates the number of times the update statement has been executed. |
DEPENDENT | mysql.com_update.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Queries per second | Number of statements executed by the server. This variable includes statements executed within stored programs, unlike the Questions variable. |
DEPENDENT | mysql.queries.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Questions per second | Number of statements executed by the server. This includes only statements sent to the server by clients and not statements executed within stored programs, unlike the Queries variable. |
DEPENDENT | mysql.questions.rate Preprocessing: - XMLPATH: - CHANGE_PER_SECOND |
MySQL | MySQL: Binlog cache disk use | Number of transactions that used a temporary disk cache because they could not fit in the regular binary log cache, being larger than binlog_cache_size. |
DEPENDENT | mysql.binlog_cache_disk_use Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Innodb buffer pool wait free | Number of times InnoDB waited for a free page before reading or creating a page. Normally, writes to the InnoDB buffer pool happen in the background. When no clean pages are available, dirty pages are flushed first in order to free some up. This counts the numbers of wait for this operation to finish. If this value is not small, look at the increasing innodb_buffer_pool_size. |
DEPENDENT | mysql.innodb_buffer_pool_wait_free Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Innodb number open files | Number of open files held by InnoDB. InnoDB only. |
DEPENDENT | mysql.innodb_num_open_files Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Open table definitions | Number of cached table definitions. |
DEPENDENT | mysql.open_table_definitions Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Open tables | Number of tables that are open. |
DEPENDENT | mysql.open_tables Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Innodb log written | Number of bytes written to the InnoDB log. |
DEPENDENT | mysql.innodb_os_log_written Preprocessing: - XMLPATH: |
MySQL | MySQL: Calculated value of innodb_log_file_size | Calculated by (innodb_os_log_written-innodb_os_log_written(time shift -1h))/{$MYSQL.INNODB_LOG_FILES} value of the innodb_log_file_size. Innodb_log_file_size is the size in bytes of the each InnoDB redo log file in the log group. The combined size can be no more than 512GB. Larger values mean less disk I/O due to less flushing checkpoint activity, but also slower recovery from a crash. |
CALCULATED | mysql.innodb_log_file_size Preprocessing: - DISCARD_UNCHANGED_HEARTBEAT: Expression: (last(mysql.innodb_os_log_written) - last(mysql.innodb_os_log_written,,1h)) / {$MYSQL.INNODB_LOG_FILES} |
MySQL | MySQL: Size of database {#DBNAME} | - |
ZABBIX_PASSIVE | mysql.dbsize["{$MYSQL.HOST}","{$MYSQL.PORT}","{#DBNAME}"] Preprocessing: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Replication Slave SQL Running State {#MASTER_HOST} | This shows the state of the SQL driver threads. |
DEPENDENT | mysql.slave_sql_running_state["{#MASTER_HOST}"] Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Replication Seconds Behind Master {#MASTERHOST} | The number of seconds that the slave SQL thread is behind processing the master binary log. A high number (or an increasing one) can indicate that the slave is unable to handle events from the master in a timely fashion. |
DEPENDENT | mysql.seconds_behind_master["{#MASTERHOST}"] Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: - NOT_MATCHES_REGEX: ⛔️ON_FAIL: |
MySQL | MySQL: Replication Slave IO Running {#MASTERHOST} | Whether the I/O thread for reading the master's binary log is running. Normally, you want this to be Yes unless you have not yet started replication or have explicitly stopped it with STOP SLAVE. |
DEPENDENT | mysql.slave_io_running["{#MASTERHOST}"] Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Replication Slave SQL Running {#MASTERHOST} | Whether the SQL thread for executing events in the relay log is running. As with the I/O thread, this should normally be Yes. |
DEPENDENT | mysql.slave_sql_running["{#MASTERHOST}"] Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Binlog commits | Total number of transactions committed to the binary log. |
DEPENDENT | mysql.binlog_commits[{#SINGLETON}] Preprocessing: - XMLPATH: |
MySQL | MySQL: Binlog group commits | Total number of group commits done to the binary log. |
DEPENDENT | mysql.binlog_group_commits[{#SINGLETON}] Preprocessing: - XMLPATH: |
MySQL | MySQL: Master GTID wait count | The number of times MASTER_GTID_WAIT called. |
DEPENDENT | mysql.master_gtid_wait_count[{#SINGLETON}] Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Master GTID wait time | Total number of time spent in MASTER_GTID_WAIT. |
DEPENDENT | mysql.master_gtid_wait_time[{#SINGLETON}] Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
MySQL | MySQL: Master GTID wait timeouts | Number of timeouts occurring in MASTER_GTID_WAIT. |
DEPENDENT | mysql.master_gtid_wait_timeouts[{#SINGLETON}] Preprocessing: - XMLPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
Zabbix_raw_items | MySQL: Get status variables | The item gets server global status information. |
ZABBIX_PASSIVE | mysql.get_status_variables["{$MYSQL.HOST}","{$MYSQL.PORT}"] |
Zabbix_raw_items | MySQL: InnoDB buffer pool read requests | Number of logical read requests. |
DEPENDENT | mysql.innodb_buffer_pool_read_requests Preprocessing: - XMLPATH: |
Zabbix_raw_items | MySQL: InnoDB buffer pool reads | Number of logical reads that InnoDB could not satisfy from the buffer pool, and had to read directly from the disk. |
DEPENDENT | mysql.innodb_buffer_pool_reads Preprocessing: - XMLPATH: |
Zabbix_raw_items | MySQL: Replication Slave status {#MASTERHOST} | The item gets status information on the essential parameters of the slave threads. |
ZABBIX_PASSIVE | mysql.slave_status["{$MYSQL.HOST}","{$MYSQL.PORT}","{#MASTERHOST}"] |
Triggers
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
MySQL: Service is down | {TEMPLATE_NAME:mysql.ping["{$MYSQL.HOST}","{$MYSQL.PORT}"].last()}=0 |
HIGH | ||
MySQL: Version has changed (new version value received: {ITEM.VALUE}) | MySQL version has changed. Ack to close. |
{TEMPLATE_NAME:mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"].diff()}=1 and {TEMPLATE_NAME:mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"].strlen()}>0 |
INFO | Manual close: YES |
MySQL: Service has been restarted (uptime < 10m) | MySQL uptime is less than 10 minutes. |
{TEMPLATE_NAME:mysql.uptime.last()}<10m |
INFO | |
MySQL: Failed to fetch info data (or no data for 30m) | Zabbix has not received data for items for the last 30 minutes. |
{TEMPLATE_NAME:mysql.uptime.nodata(30m)}=1 |
INFO | Depends on: - MySQL: Service is down |
MySQL: Server has aborted connections (over {$MYSQL.ABORTED_CONN.MAX.WARN} for 5m) | The number of failed attempts to connect to the MySQL server is more than {$MYSQL.ABORTED_CONN.MAX.WARN} in the last 5 minutes. |
{TEMPLATE_NAME:mysql.aborted_connects.rate.min(5m)}>{$MYSQL.ABORTED_CONN.MAX.WARN} |
AVERAGE | Depends on: - MySQL: Refused connections (max_connections limit reached) |
MySQL: Refused connections (max_connections limit reached) | Number of refused connections due to the max_connections limit being reached. |
{TEMPLATE_NAME:mysql.connection_errors_max_connections.rate.last()}>0 |
AVERAGE | |
MySQL: Buffer pool utilization is too low (less than {$MYSQL.BUFF_UTIL.MIN.WARN}% for 5m) | The buffer pool utilization is less than {$MYSQL.BUFF_UTIL.MIN.WARN}% in the last 5 minutes. This means that there is a lot of unused RAM allocated for the buffer pool, which you can easily reallocate at the moment. |
{TEMPLATE_NAME:mysql.buffer_pool_utilization.max(5m)}<{$MYSQL.BUFF_UTIL.MIN.WARN} |
WARNING | |
MySQL: Number of temporary files created per second is high (over {$MYSQL.CREATED_TMP_FILES.MAX.WARN} for 5m) | Possibly the application using the database is in need of query optimization. |
{TEMPLATE_NAME:mysql.created_tmp_files.rate.min(5m)}>{$MYSQL.CREATED_TMP_FILES.MAX.WARN} |
WARNING | |
MySQL: Number of on-disk temporary tables created per second is high (over {$MYSQL.CREATED_TMP_DISK_TABLES.MAX.WARN} for 5m) | Possibly the application using the database is in need of query optimization. |
{TEMPLATE_NAME:mysql.created_tmp_disk_tables.rate.min(5m)}>{$MYSQL.CREATED_TMP_DISK_TABLES.MAX.WARN} |
WARNING | |
MySQL: Number of internal temporary tables created per second is high (over {$MYSQL.CREATED_TMP_TABLES.MAX.WARN} for 5m) | Possibly the application using the database is in need of query optimization. |
{TEMPLATE_NAME:mysql.created_tmp_tables.rate.min(5m)}>{$MYSQL.CREATED_TMP_TABLES.MAX.WARN} |
WARNING | |
MySQL: Server has slow queries (over {$MYSQL.SLOW_QUERIES.MAX.WARN} for 5m) | The number of slow queries is more than {$MYSQL.SLOW_QUERIES.MAX.WARN} in the last 5 minutes. |
{TEMPLATE_NAME:mysql.slow_queries.rate.min(5m)}>{$MYSQL.SLOW_QUERIES.MAX.WARN} |
WARNING | |
MySQL: Replication lag is too high (over {$MYSQL.REPL_LAG.MAX.WARN} for 5m) | - |
{TEMPLATE_NAME:mysql.seconds_behind_master["{#MASTERHOST}"].min(5m)}>{$MYSQL.REPL_LAG.MAX.WARN} |
WARNING | |
MySQL: The slave I/O thread is not running | Whether the I/O thread for reading the master's binary log is running. |
{TEMPLATE_NAME:mysql.slave_io_running["{#MASTERHOST}"].count(#1,"No",eq)}=1 |
AVERAGE | |
MySQL: The slave I/O thread is not connected to a replication master | - |
{TEMPLATE_NAME:mysql.slave_io_running["{#MASTERHOST}"].count(#1,"Yes",ne)}=1 |
WARNING | Depends on: - MySQL: The slave I/O thread is not running |
MySQL: The SQL thread is not running | Whether the SQL thread for executing events in the relay log is running. |
{TEMPLATE_NAME:mysql.slave_sql_running["{#MASTERHOST}"].count(#1,"No",eq)}=1 |
WARNING | Depends on: - MySQL: The slave I/O thread is not running |
Feedback
Please report any issues with the template at https://support.zabbix.com
You can also provide a feedback, discuss the template or ask for help with it at ZABBIX forums.