MariaDB extension

  • Latest Dynatrace
  • Extension

Remotely monitor your MariaDB instances, collect key KPIs & slow queries details

Overview dashboardInstance screenInstance screen pt. 2Instances list screen
1 of 4Overview dashboard

Get started

Overview

Monitor your MariaDB instances remotely and collect key performance indicators and slow query details.

Requirements

  • Install ActiveGate with version 1.295 or later.

  • Download the Java 8+ platform-independent connector, and copy the JAR file to this directory on all ActiveGates in your desired group:

    • Windows: C:\ProgramData\dynatrace\remotepluginmodule\agent\conf\userdata\libs
    • Linux: /var/lib/dynatrace/remotepluginmodule/agent/conf/userdata/libs
  • Ensure the dtuserag user has read access to the driver.

  • Add custom_code_jdbc_allowed=true to extensionsuser.conf.

  • Restart the EEC service.

  • Ensure the performance schema is activated and enabled for the MariaDB instances you monitor.

  • Download the MariaDB JDBC driver from MariaDB Downloads.

  • Create a dedicated database user in your database instance with necessary permissions. Dynatrace uses this user to run monitoring queries against your MariaDB database.

    • Configure a user with permissions

      1. Create a user that is identified by a native password. Customize the username and password as needed:
      CREATE USER 'dynatrace'@'%' IDENTIFIED BY 'password';
      1. Grant the user these permissions:

      • GRANT SELECT ON performance_schema.* TO 'dynatrace'@'%';
        • Allows querying the performance_schema database.
      • GRANT PROCESS ON *.* TO 'dynatrace'@'%';
        • Allows viewing thread and connection metrics for all users.
      • GRANT SHOW DATABASES ON *.* TO 'dynatrace'@'%';
        • Allows viewing database metrics for all databases.
      • GRANT SELECT ON sys.x$memory_global_by_current_bytes TO 'dynatrace'@'%';
        • Allows querying memory statistics.
      • GRANT SLAVE MONITOR ON *.* TO 'dynatrace'@'%';
        • Allows querying slave/replica metrics.

      Due to a MariaDB limitation, you have to grant SELECT permissions on individual databases to calculate their sizes.

Compatibility information

global_status and global_status_extended feature sets: MariaDB 10.5.2+

replicas and replica_error_logs feature sets: MariaDB 11.6+

Activation and setup

Add DB instance

  1. Go to Dynatrace Hub Hub.

  2. Select and install MariaDB extension. This enables the extension in your monitoring environment.

    • Required permission: Change monitoring settings
  3. Select Add DB Instance in the Databases Databases. This opens the Add DB Instance wizard.

  4. Select MariaDB section in the wizard.

Select hosting type

Select a hosting type from the options. This choice determines which script generates the necessary database objects later in the process.

  1. From the Add DB Instance wizard, select the host type that matches your requirement.
  2. Select Next.

Select ActiveGate group

  1. Select the ActiveGate group to determine which ActiveGates will run the extension.
  2. Select Next step.

Create a connection

Set up the connection to your database instance.

  1. Name the connection, so you can identify it later.
  2. Add the details in the Configure connection section.
    1. Provide the following connection details:
      • Host
      • Port
      • Connection string
  3. Provide the Authenticate credentials directly or use secure alternatives.
    • Basic credentials: With basic authentication, authentication details passed to Dynatrace when activating monitoring configuration are masked to prevent them from being retrieved.
    • Credential vault: Use vault credentials to securely store and retrieve database credentials.
  4. Select Next.

Install instance

  1. Add manual configurations based on the monitoring requirements.
    • Add configurations to collect top slow queries

      This applies to the top_queries feature set, which retrieves data from performance_schema.events_statements_summary_by_digest:

      • Enable the necessary statement instruments - this tells MariaDB to track all statements:

        UPDATE performance_schema.setup_instruments
        SET ENABLED = 'YES', TIMED = 'YES'
        WHERE NAME LIKE 'statement/%';
      • Enable the consumers - this tells MariaDB where to store the tracked statements:

        UPDATE performance_schema.setup_consumers
        SET ENABLED = 'YES'
        WHERE NAME IN ('events_statements_history', 'events_statements_summary_by_digest');

        While the above commands work, create a custom Parameter Group for a more robust RDS configuration. In the parameter group, set performance_schema to 1 and enable the consumer settings. This configuration persists across restarts and instance modifications. For more information, see Turn on the Performance Schema for Amazon RDS for MariaDB or MySQL.

  2. Select Create DB instance monitoring.

Details

Licensing and cost

The extension uses this formula to calculate data points per minute:

(69 * # of Instances) + (1 * # of Databases)

Multiply by 0.001 to get DDUs per minute or by 525,600 to get data points per year.

If your license consists of Custom Metrics, each custom metric is equivalent to 525.6 DDUs/yr. For more details, see metric cost calculation.

This extension ingests logs. To calculate consumption, refer to the documentation for your licensing model:

Feature sets

When activating your extension using monitoring configuration, you can limit monitoring to one of the feature sets. To work properly, the extension has to collect at least one metric after the activation.

In highly segmented networks, feature sets can reflect the segments of your environment. Then, when you create a monitoring configuration, you can select a feature set and a corresponding ActiveGate group that can connect to this particular segment.

All metrics that aren't categorized into any feature set are considered to be the default and are always reported.

A metric inherits the feature set of a subgroup, which in turn inherits the feature set of a group. Also, the feature set defined on the metric level overrides the feature set defined on the subgroup level, which in turn overrides the feature set defined on the group level.

globalStatusExtended
Metric nameMetric keyDescription
Query Cache Queries in Cachemariadb.global_status.qcache_queries_in_cache.countThe number of queries registered in the query cache.
Query Cache Free Blocksmariadb.global_status.qcache_free_blocksThe number of free memory blocks in the query cache.
Query Cache Total Blocksmariadb.global_status.qcache_total_blocksThe total number of blocks in the query cache.
Created Temporary Tablesmariadb.global_status.created_tmp_tables.countThe number of internal temporary tables created by the server while executing statements. You can compare the number of internal on-disk temporary tables created to the total number of internal temporary tables created by comparing Created_tmp_disk_tables and Created_tmp_tables values.
Created Temporary Disk Tablesmariadb.global_status.created_tmp_disk_tables.countThe number of internal on-disk temporary tables created by the server while executing statements. You can compare the number of internal on-disk temporary tables created to the total number of internal temporary tables created by comparing Created_tmp_disk_tables and Created_tmp_tables values.
Innodb Buffer Pool Sizemariadb.global_status.innodb_buffer_pool_sizeThe size in bytes of the buffer pool, the memory area where InnoDB caches table and index data.
databases
Metric nameMetric keyDescription
Database Sizemariadb.databases.sizeThe size of the Database
replicas
Metric nameMetric keyDescription
Slave IO Runningmariadb.replica.slave_io_runningWhether the replica I/O thread is running and connected (Yes - 1), running but not connected to a primary (Connecting - 2) or not running (No - 0).
Slave SQL Runningmariadb.replica.slave_sql_runningWhether the SQL thread is running and connected (Yes - 1), running but not connected to a primary (Connecting - 2) or not running (No - 0).
Relay Log Spacemariadb.replica.relay_log_spaceTotal size of all relay log files combined.
Last IO Errnomariadb.replica.last_io_errnoError code of the most recent error that caused the I/O thread to stop (also recorded in the replica's error log). 0 means no error. RESET SLAVE or RESET MASTER will reset this value.
Last SQL Errnomariadb.replica.last_sql_errnoError code of the most recent error that caused the SQL thread to stop (also recorded in the replica's error log). 0 means no error. RESET SLAVE or RESET MASTER will reset this value.
Seconds Behind Mastermariadb.replica.seconds_behind_masterDifference between the timestamp logged on the master for the event that the replica is currently processing, and the current timestamp on the replica. Zero if the replica is not currently processing an event.
Read Master Log Positionmariadb.replica.read_master_log_posPosition up to which the I/O thread has read in the current primary binary log file.
Exec Master Log Positionmariadb.replica.exec_master_log_posPosition up to which the SQL thread has processed in the current master binary log file.
statements
Metric nameMetric keyDescription
Commitsmariadb.statements.commit.countThe number of COMMIT statements executed by this server
Deletesmariadb.statements.delete.countThe number of DELETE statements executed by this server
Multi-Table Deletesmariadb.statements.delete_multi.countThe number of multi-table DELETE statements executed by this server
Insertsmariadb.statements.insert.countThe number of INSERT statements executed by this server
Selectsmariadb.statements.select.countThe number of SELECT statements executed by this server
Updatesmariadb.statements.update.countThe number of UPDATE statements executed by this server
Executesmariadb.statements.execute.countThe number of EXECUTE statements executed by this server
Multi-Table Updatesmariadb.statements.update_multi.countThe number of multi-table UPDATE statements executed by this server
Bytes Sentmariadb.statements.bytes_sent.countThe number of bytes sent to all clients
Bytes Receivedmariadb.statements.bytes_received.countThe number of bytes received from all clients
Rollbacksmariadb.statements.rollback.countThe number of ROLLBACK statements executed by this server
Insert Selectsmariadb.statements.insert_select.countThe number of insert-select statements executed by this server
Replace Selectsmariadb.statements.replace_select.countThe number of replace-select statements executed by this server
Prepared Statementsmariadb.statements.prepared_stmt_count.countThe current number of prepared statements
replicaErrorLogs
Metric nameMetric keyDescription
waits
Metric nameMetric keyDescription
Waits IOmariadb.waits.waits_io.countThe number of times that the server has waited for an I/O operation to complete.
Waits IO Timemariadb.waits.waits_io_time.countThe total time the server has waited for I/O operations to complete.
Waits Syncmariadb.waits.waits_sync.countThe number of times that the server has waited for a synchronization operation to complete.
Waits Sync Timemariadb.waits.waits_sync_time.countThe total time the server has waited for synchronization operations to complete.
topQueries
Metric nameMetric keyDescription
infrastructure
Metric nameMetric keyDescription
Memorymariadb.infrastructure.memoryThe amount of memory used per each code area.
globalStatus
Metric nameMetric keyDescription
Queriesmariadb.global_status.queries.countThe number of statements executed by the server. This variable includes statements executed within stored programs, unlike the Questions variable. It does not count COM_PING or COM_STATISTICS commands.
Slow Queriesmariadb.global_status.slow_queries.countThe 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.
Table Locks Waitedmariadb.global_status.table_locks_waited.countThe 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.
Table Locks Immediatemariadb.global_status.table_locks_immediate.countThe number of times that a request for a table lock could be granted immediately.
Current Connectionsmariadb.global_status.current_connectionsThe number of currently open connections.
Threads Runningmariadb.global_status.threads_runningThe number of threads that are not sleeping.
Threads Createdmariadb.global_status.threads_createdThe 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.
Innodb Buffer Pool Pages Datamariadb.global_status.innodb_buffer_pool_pages_dataThe 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
Innodb Buffer Pool Pages Dirtymariadb.global_status.innodb_buffer_pool_pages_dirtyThe current number of dirty pages in the InnoDB buffer pool.
Innodb Buffer Pool Pages Freemariadb.global_status.innodb_buffer_pool_pages_freeThe number of free pages in the InnoDB buffer pool.
Innodb Buffer Pool Pages Totalmariadb.global_status.innodb_buffer_pool_pages_totalThe 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
Innodb Data Readsmariadb.global_status.innodb_data_reads.countThe total number of data reads (OS file reads).
Innodb Data Writesmariadb.global_status.innodb_data_writes.countThe total number of data writes.
Innodb Data Readmariadb.global_status.innodb_data_read.countThe total amount of data read from files.
Innodb Data Writtenmariadb.global_status.innodb_data_written.countThe total amount of data written.
Innodb Buffer Pool Readsmariadb.global_status.innodb_buffer_pool_readsThe number of logical reads that InnoDB could not satisfy from the buffer pool, and had to read directly from disk.
Innodb Buffer Pool Read Requestsmariadb.global_status.innodb_buffer_pool_read_requestsThe number of logical read requests.
Availabilitymariadb.global_status.availabilityWhether or not a connection can be made to the database
Statusmariadb.global_status.statusA status of AVAILABLE is returned if we can query the database
Uptimemariadb.global_status.uptimeThe time in seconds that the mariadb server has been running since it was started.
Handler Rollbackmariadb.global_status.handler_rollback.countThe number of requests for a storage engine to perform a rollback operation.
Innodb Log Waitsmariadb.global_status.innodb_log_waits.countThe number of times that the log buffer was too small and a wait was required for it to be flushed before continuing.
Innodb Row Lock Current Waitsmariadb.global_status.innodb_row_lock_current_waitsThe number of row locks currently waited for by operations on InnoDB tables.
Innodb Row Lock Time (Avg)mariadb.global_status.innodb_row_lock_time_avgThe average time to acquire a row lock for InnoDB tables
Innodb Row Lock Waitsmariadb.global_status.innodb_row_lock_waits.countThe number of times operations on InnoDB tables had to wait for a row lock.
Opened Tablesmariadb.global_status.opened_tables.countThe number of tables that have been opened. If Opened_tables is big, your table_open_cache value is probably too small.
Open Filesmariadb.global_status.open_filesThe number of files that are open. This count includes regular files opened by the server. It does not include other types of files such as sockets or pipes. Also, the count does not include files that storage engines open using their own internal functions rather than asking the server level to do so.
Open Tablesmariadb.global_status.open_tablesThe number of tables that are open.
Query Cache Free Memorymariadb.global_status.qcache_free_memoryThe amount of free memory for the query cache.
Query Cache Hitsmariadb.global_status.qcache_hits.countThe number of query cache hits.
Query Cache not Cachedmariadb.global_status.qcache_not_cached.countThe number of noncached queries (not cacheable, or not cached due to the query_cache_type setting).
Aborted Clientsmariadb.global_status.aborted_clients.countThe number of connections that were aborted because the client died without closing the connection properly.
Aborted Connectsmariadb.global_status.aborted_connects.countThe number of failed attempts to connect to the MySQL server.
Connection Errors Max Connectionsmariadb.global_status.connection_errors_max_connections.countThe number of connections refused because the server max_connections limit was reached.
Max Used Connectionsmariadb.global_status.max_used_connectionsThe maximum number of connections that have been in use simultaneously since the server started.
Questionsmariadb.global_status.questions.countThe 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. This variable does not count COM_PING, COM_STATISTICS, COM_STMT_PREPARE, COM_STMT_CLOSE, or COM_STMT_RESET commands.

FAQ

Why am I not seeing wait metrics?

To gather wait metrics, enable data collection for the MariaDB instance. For details, see Performance schema wait event tables.

I get an error "RSA public key is not available client side"

This means the username is not identified by a native password. Refer to the activation and setup section.

Why am I not seeing memory metrics?

Enable data collection for your instance.

For more details, see Monitor MySQL memory use.

You can test that you can query the data by running:

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;
Why am I not able to see slow queries?
Related tags
DatabaseSQLSQLMariaDBApplication Observability