From 4a1114da45e52d26bdd675cd77b53473f1c1732a Mon Sep 17 00:00:00 2001
From: Vlad Medvedev <nxrg@yandex.ru>
Date: Thu, 7 Oct 2021 16:56:52 +0300
Subject: [PATCH 1/2] Make 'MySQL by Zabbix agent 2' template compatible to
 commit 12866d3f110 (2021-06-26)

Signed-off-by: Vlad Medvedev <nxrg@yandex.ru>
---
 .../db/mysql_agent2/template_db_mysql_agent2.yaml    | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/templates/db/mysql_agent2/template_db_mysql_agent2.yaml b/templates/db/mysql_agent2/template_db_mysql_agent2.yaml
index 6abc3e5..b5eed08 100644
--- a/templates/db/mysql_agent2/template_db_mysql_agent2.yaml
+++ b/templates/db/mysql_agent2/template_db_mysql_agent2.yaml
@@ -1213,7 +1213,7 @@ zabbix_export:
             -
               uuid: e3e3c31483e94be2bd24b062bb049027
               name: 'MySQL: Size of database {#DATABASE}'
-              key: 'mysql.db.size["{$MYSQL.DSN}","{$MYSQL.USER}","{$MYSQL.PASSWORD}","{#DATABASE}"]'
+              key: 'mysql.db.size["{$MYSQL.DSN}","{$MYSQL.USER}","{$MYSQL.PASSWORD}","","","","","{#DATABASE}"]'
               delay: 5m
               history: 7d
               units: B
@@ -1372,7 +1372,7 @@ zabbix_export:
             -
               uuid: 130d6421b7864444a083dc7ffb1c03c5
               name: 'MySQL: Replication Slave status {#MASTER_HOST}'
-              key: 'mysql.replication.get_slave_status["{$MYSQL.DSN}","{$MYSQL.USER}","{$MYSQL.PASSWORD}","{#MASTER_HOST}"]'
+              key: 'mysql.replication.get_slave_status["{$MYSQL.DSN}","{$MYSQL.USER}","{$MYSQL.PASSWORD}","","","","","{#MASTER_HOST}"]'
               history: '0'
               trends: '0'
               value_type: TEXT
@@ -1409,7 +1409,7 @@ zabbix_export:
                   parameters:
                     - 1h
               master_item:
-                key: 'mysql.replication.get_slave_status["{$MYSQL.DSN}","{$MYSQL.USER}","{$MYSQL.PASSWORD}","{#MASTER_HOST}"]'
+                key: 'mysql.replication.get_slave_status["{$MYSQL.DSN}","{$MYSQL.USER}","{$MYSQL.PASSWORD}","","","","","{#MASTER_HOST}"]'
               tags:
                 -
                   tag: Application
@@ -1443,7 +1443,7 @@ zabbix_export:
                   parameters:
                     - 1h
               master_item:
-                key: 'mysql.replication.get_slave_status["{$MYSQL.DSN}","{$MYSQL.USER}","{$MYSQL.PASSWORD}","{#MASTER_HOST}"]'
+                key: 'mysql.replication.get_slave_status["{$MYSQL.DSN}","{$MYSQL.USER}","{$MYSQL.PASSWORD}","","","","","{#MASTER_HOST}"]'
               tags:
                 -
                   tag: Application
@@ -1486,7 +1486,7 @@ zabbix_export:
                   parameters:
                     - 1h
               master_item:
-                key: 'mysql.replication.get_slave_status["{$MYSQL.DSN}","{$MYSQL.USER}","{$MYSQL.PASSWORD}","{#MASTER_HOST}"]'
+                key: 'mysql.replication.get_slave_status["{$MYSQL.DSN}","{$MYSQL.USER}","{$MYSQL.PASSWORD}","","","","","{#MASTER_HOST}"]'
               tags:
                 -
                   tag: Application
@@ -1522,7 +1522,7 @@ zabbix_export:
                   parameters:
                     - 6h
               master_item:
-                key: 'mysql.replication.get_slave_status["{$MYSQL.DSN}","{$MYSQL.USER}","{$MYSQL.PASSWORD}","{#MASTER_HOST}"]'
+                key: 'mysql.replication.get_slave_status["{$MYSQL.DSN}","{$MYSQL.USER}","{$MYSQL.PASSWORD}","","","","","{#MASTER_HOST}"]'
               tags:
                 -
                   tag: Application
-- 
2.33.0


From 79ffd0a5269b6fe12595fc20a1c7551e28dc322b Mon Sep 17 00:00:00 2001
From: Vlad Medvedev <nxrg@yandex.ru>
Date: Thu, 7 Oct 2021 17:02:49 +0300
Subject: [PATCH 2/2] Make 'MySQL by Zabbix agent 2' template compatible to
 commit 12866d3f110 (2021-06-26)

Signed-off-by: Vlad Medvedev <nxrg@yandex.ru>
---
 templates/db/mysql_agent2/README.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/templates/db/mysql_agent2/README.md b/templates/db/mysql_agent2/README.md
index e1e0980..e32ef9e 100644
--- a/templates/db/mysql_agent2/README.md
+++ b/templates/db/mysql_agent2/README.md
@@ -114,7 +114,7 @@ There are no template links in this template.
 |MySQL |MySQL: Open tables |<p>Number of tables that are open.</p> |DEPENDENT |mysql.open_tables<p>**Preprocessing**:</p><p>- JSONPATH: `$.Open_tables`</p><p>- DISCARD_UNCHANGED_HEARTBEAT: `6h`</p> |
 |MySQL |MySQL: Innodb log written |<p>Number of bytes written to the InnoDB log.</p> |DEPENDENT |mysql.innodb_os_log_written<p>**Preprocessing**:</p><p>- JSONPATH: `$.Innodb_os_log_written`</p><p>- DISCARD_UNCHANGED_HEARTBEAT: `6h`</p> |
 |MySQL |MySQL: Calculated value of innodb_log_file_size |<p>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.</p> |CALCULATED |mysql.innodb_log_file_size<p>**Preprocessing**:</p><p>- DISCARD_UNCHANGED_HEARTBEAT: `6h`</p><p>**Expression**:</p>`(last(mysql.innodb_os_log_written) - last(mysql.innodb_os_log_written,1h)) / {$MYSQL.INNODB_LOG_FILES}` |
-|MySQL |MySQL: Size of database {#DATABASE} |<p>-</p> |ZABBIX_PASSIVE |mysql.db.size["{$MYSQL.DSN}","{$MYSQL.USER}","{$MYSQL.PASSWORD}","{#DATABASE}"]<p>**Preprocessing**:</p><p>- DISCARD_UNCHANGED_HEARTBEAT: `1h`</p> |
+|MySQL |MySQL: Size of database {#DATABASE} |<p>-</p> |ZABBIX_PASSIVE |mysql.db.size["{$MYSQL.DSN}","{$MYSQL.USER}","{$MYSQL.PASSWORD}","","","","","{#DATABASE}"]<p>**Preprocessing**:</p><p>- DISCARD_UNCHANGED_HEARTBEAT: `1h`</p> |
 |MySQL |MySQL: Replication Slave SQL Running State {#MASTER_HOST} |<p>This shows the state of the SQL driver threads.</p> |DEPENDENT |mysql.replication.slave_sql_running_state["{#MASTER_HOST}"]<p>**Preprocessing**:</p><p>- JSONPATH: `$.Slave_SQL_Running_State`</p><p>- DISCARD_UNCHANGED_HEARTBEAT: `6h`</p> |
 |MySQL |MySQL: Replication Seconds Behind Master {#MASTER_HOST} |<p>Number of seconds that the slave SQL thread is behind processing the master binary log.</p><p>A high number (or an increasing one) can indicate that the slave is unable to handle events</p><p>from the master in a timely fashion.</p> |DEPENDENT |mysql.replication.seconds_behind_master["{#MASTER_HOST}"]<p>**Preprocessing**:</p><p>- JSONPATH: `$.Seconds_Behind_Master`</p><p>- MATCHES_REGEX: `\d+`</p><p>⛔️ON_FAIL: `CUSTOM_ERROR -> Replication is not performed.`</p><p>- DISCARD_UNCHANGED_HEARTBEAT: `1h`</p> |
 |MySQL |MySQL: Replication Slave IO Running {#MASTER_HOST} |<p>Whether the I/O thread for reading the master's binary log is running. </p><p>Normally, you want this to be Yes unless you have not yet started a replication or have </p><p>explicitly stopped it with STOP SLAVE.</p> |DEPENDENT |mysql.replication.slave_io_running["{#MASTER_HOST}"]<p>**Preprocessing**:</p><p>- JSONPATH: `$.Slave_IO_Running`</p><p>- DISCARD_UNCHANGED_HEARTBEAT: `1h`</p> |
@@ -127,7 +127,7 @@ There are no template links in this template.
 |Zabbix_raw_items |MySQL: Get status variables |<p>The item gets server global status information.</p> |ZABBIX_PASSIVE |mysql.get_status_variables["{$MYSQL.DSN}","{$MYSQL.USER}","{$MYSQL.PASSWORD}"] |
 |Zabbix_raw_items |MySQL: InnoDB buffer pool read requests |<p>Number of logical read requests.</p> |DEPENDENT |mysql.innodb_buffer_pool_read_requests<p>**Preprocessing**:</p><p>- JSONPATH: `$.Innodb_buffer_pool_read_requests`</p> |
 |Zabbix_raw_items |MySQL: InnoDB buffer pool reads |<p>Number of logical reads that InnoDB could not satisfy from the buffer pool, and had to read directly from the disk.</p> |DEPENDENT |mysql.innodb_buffer_pool_reads<p>**Preprocessing**:</p><p>- JSONPATH: `$.Innodb_buffer_pool_reads`</p> |
-|Zabbix_raw_items |MySQL: Replication Slave status {#MASTER_HOST} |<p>The item gets status information on the essential parameters of the slave threads.</p> |ZABBIX_PASSIVE |mysql.replication.get_slave_status["{$MYSQL.DSN}","{$MYSQL.USER}","{$MYSQL.PASSWORD}","{#MASTER_HOST}"] |
+|Zabbix_raw_items |MySQL: Replication Slave status {#MASTER_HOST} |<p>The item gets status information on the essential parameters of the slave threads.</p> |ZABBIX_PASSIVE |mysql.replication.get_slave_status["{$MYSQL.DSN}","{$MYSQL.USER}","{$MYSQL.PASSWORD}","","","","","{#MASTER_HOST}"] |
 
 ## Triggers
 
-- 
2.33.0

