Extend the platform,
empower your team.
Remotely monitor your MySQL instances, collect key KPIs and slow queries details
ExtensionRemotely monitor MySQL databases where you cannot install an OneAgent.
Create a user that is identified by a native password, customize the username and password as you please
CREATE USER 'dynatrace'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
Give the user the permissions:
GRANT SELECT ON performance_schema.* TO 'dynatrace'@'%';
GRANT PROCESS ON *.* TO 'dynatrace'@'%';
GRANT SHOW DATABASES ON *.* TO 'dynatrace'@'%';
GRANT SELECT ON mysql.slow_log TO 'dynatrace'@'%';
GRANT SELECT ON sys.x$memory_global_by_current_bytes TO 'dynatrace'@'%';
To enable CPU metrics collection, run this query on the MySQL instance:
SET GLOBAL innodb_monitor_enable='cpu%';
Enable slow queries logging to a table:
SET GLOBAL log_output = 'TABLE';
SET GLOBAL slow_query_log = 'ON';
The default slow query threshold is 10 seconds You can chose the threshold of what is a "slow query" by executing:
SET GLOBAL long_query_time = 2;
This would set slow queries threshold to 2 seconds.
To fetch execution plans, you must create a stored procedure for the dynatrace
user:
CREATE SCHEMA IF NOT EXISTS dynatrace;
DELIMITER $$
CREATE PROCEDURE dynatrace.dynatrace_execution_plan(IN query TEXT)
SQL SECURITY DEFINER
BEGIN
SET @explain := CONCAT('EXPLAIN FORMAT=JSON ', query);
PREPARE stmt FROM @explain;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END $$
DELIMITER ;
And then gran execution permission for the dynatrace
user
GRANT EXECUTE ON PROCEDURE dynatrace.dynatrace_execution_plan TO 'dynatrace'@'%';
To gather wait metrics, data collection need to be enabled for the MySQL instance, please refer to the documentation: https://dev.mysql.com/doc/mysql-perfschema-excerpt/8.0/en/performance-schema-wait-tables.html
This extension was only tested against MySQL instances, MariaDB is not officially supported via this extension.
This means that the username is not identified by a native password, please refer to Get Started.
Make sure that data collection is enabled for your instance.
SET GLOBAL innodb_monitor_enable='cpu%';
You can test that you can query the data by running:
SELECT * FROM information_schema.INNODB_METRICS WHERE name IN ('cpu_utime_abs', 'cpu_stime_abs');
And:
SELECT SUBSTRING_INDEX(event_name,'/',2) AS code_area,
SUM(current_alloc) AS current_alloc
FROM sys.x$memory_global_by_current_bytes
GROUP BY SUBSTRING_INDEX(event_name,'/',2)
ORDER BY SUM(current_alloc) DESC;
Refer to the Collecting Top Slow Queries
in the Getting Started session.
Below is a complete list of the feature sets provided in this version. To ensure a good fit for your needs, individual feature sets can be activated and deactivated by your administrator during configuration.
Metric name | Metric key | Description | Unit |
---|---|---|---|
Waits IO | mysql.waits.waits_io.count | The number of times that the server has waited for an I/O operation to complete. | Count |
Waits IO Time | mysql.waits.waits_io_time.count | The total time the server has waited for I/O operations to complete. | MilliSecond |
Waits Sync | mysql.waits.waits_sync.count | The number of times that the server has waited for a synchronization operation to complete. | Count |
Waits Sync Time | mysql.waits.waits_sync_time.count | The total time the server has waited for synchronization operations to complete. | MilliSecond |
Metric name | Metric key | Description | Unit |
---|---|---|---|
Commits | mysql.statements.commit.count | The number of COMMIT statements executed by this server | Count |
Deletes | mysql.statements.delete.count | The number of DELETE statements executed by this server | Count |
Multi-Table Deletes | mysql.statements.delete_multi.count | The number of multi-table DELETE statements executed by this server | Count |
Inserts | mysql.statements.insert.count | The number of INSERT statements executed by this server | Count |
Selects | mysql.statements.select.count | The number of SELECT statements executed by this server | Count |
Updates | mysql.statements.update.count | The number of UPDATE statements executed by this server | Count |
Executes | mysql.statements.execute.count | The number of EXECUTE statements executed by this server | Count |
Multi-Table Updates | mysql.statements.update_multi.count | The number of multi-table UPDATE statements executed by this server | Count |
Bytes Sent | mysql.statements.bytes_sent.count | The number of bytes sent to all clients | Byte |
Bytes Received | mysql.statements.bytes_received.count | The number of bytes received from all clients | Byte |
Metric name | Metric key | Description | Unit |
---|---|---|---|
- | mysql.global_status.queries.count | - | - |
Slow Queries | mysql.global_status.slow_queries.count | The number of queries that have taken more than long_query_time seconds. This counter increments regardless of whether the slow query log is enabled. For information about that log, see Section 5.4.5, The Slow Query Log. | Count |
Table Locks Waited | mysql.global_status.table_locks_waited.count | The number of times that a request for a table lock could not be granted immediately and a wait was needed. If this is high and you have performance problems, you should first optimize your queries, and then either split your table or tables or use replication. | Count |
Table Locks Immediate | mysql.global_status.table_locks_immediate.count | The number of times that a request for a table lock could be granted immediately. | Count |
Current Connections | mysql.global_status.current_connections | The number of currently open connections. | Count |
Threads Running | mysql.global_status.threads_running | The number of threads that are not sleeping. | Count |
Innodb Buffer Pool Pages Data | mysql.global_status.innodb_buffer_pool_pages_data | The number of pages in the InnoDB buffer pool containing data. The number includes both dirty and clean pages. When using compressed tables, the reported Innodb_buffer_pool_pages_data value may be larger than Innodb_buffer_pool_pages_total | Count |
Innodb Buffer Pool Pages Dirty | mysql.global_status.innodb_buffer_pool_pages_dirty | The current number of dirty pages in the InnoDB buffer pool. | Count |
Innodb Buffer Pool Pages Free | mysql.global_status.innodb_buffer_pool_pages_free | The number of free pages in the InnoDB buffer pool. | Count |
Innodb Buffer Pool Pages Total | mysql.global_status.innodb_buffer_pool_pages_total | The total size of the InnoDB buffer pool, in pages. When using compressed tables, the reported Innodb_buffer_pool_pages_data value may be larger than Innodb_buffer_pool_pages_total | Count |
Innodb Data Reads | mysql.global_status.innodb_data_reads.count | The total number of data reads (OS file reads). | Count |
Innodb Data Writes | mysql.global_status.innodb_data_writes.count | The total number of data writes. | Count |
Innodb Data Read | mysql.global_status.innodb_data_read.count | The total amount of data read from files. | Byte |
Innodb Data Written | mysql.global_status.innodb_data_written.count | The total amount of data written. | Byte |
Availability | mysql.global_status.availability | Whether or not a connection can be made to the database | Percent |
Status | mysql.global_status.status | A status of AVAILABLE is returned if we can query the database | State |
Metric name | Metric key | Description | Unit |
---|---|---|---|
CPU User | mysql.infrastructure.cpu.user | The total CPU time spent in user mode. | Percent |
CPU System | mysql.infrastructure.cpu.system | The total CPU time spent in system mode. | Percent |
Memory | mysql.infrastructure.memory | The amount of memory used per each code area. | Byte |
Metric name | Metric key | Description | Unit |
---|---|---|---|
Database Size | mysql.databases.size | The size of the Database | MegaByte |
Note: these features require Activegate 1.293+
Add metrics: