Project: SkyWalking (Observability and Analysis / Observability)
File: backend-mysql-monitoring.md

SkyWalking leverages prometheus/mysqld_exporter for collecting metrics data. It leverages OpenTelemetry Collector to transfer the metrics to and into the . mysqld_exporter collect metrics data from MySQL/MariaDB. OpenTelemetry Collector fetches metrics from mysqld_exporter via Prometheus Receiver and pushes metrics to SkyWalking OAP Server via OpenTelemetry gRPC exporter. The SkyWalking OAP Server parses the expression with to filter/calculate/aggregate and store the results. Set up . Set up . For details on Prometheus Receiver in OpenTelemetry Collector, refer to . Config SkyWalking . MySQL/MariaDB monitoring provides monitoring of the status and resources of the MySQL/MariaDB server. MySQL/MariaDB cluster is cataloged as a `Layer: MYSQL` `Service` in OAP. Each MySQL/MariaDB server is cataloged as an `Instance` in OAP. | Monitoring Panel | Unit | Metric Name | Description | Data Source | |--||--|--|--| | MySQL Uptime | day | metermysqluptime | The MySQL startup time | mysqld_exporter| | Max Connections | | metermysqlmaxconnections | The max number of connections. | mysqldexporter| | Innodb Buffer Pool Size | MB | metermysqlinnodbbufferpoolsize | The buffer pool size in Innodb engine | mysqldexporter| | Thread Cache Size | | metermysqlthreadcachesize | The size of thread cache | mysqld_exporter| | Current QPS| | metermysqlqps | Queries Per Second | mysqld_exporter| | Current TPS | | metermysqltps | Transactions Per Second | mysqld_exporter| | Commands Rate | | metermysqlcommandsinsertrate <br/>metermysqlcommandsselectrate<br />metermysqlcommandsdeleterate<br />metermysqlcommandsupdaterate | The rate of total number of insert/select/delete/update executed by the current server | mysqld_exporter| | Threads | | metermysqlthreadsconnected<br />metermysqlthreadscreated<br />metermysqlthreadscached<br />metermysqlthreadsrunning | The number of currently open connections(threadsconnected) <br/> The number of threads created(threadscreated) <br/> The number of threads in the thread cache(threadscached) <br/> The number of threads that are not sleeping(threadsrunning) | mysqld_exporter| | Connects | | metermysqlmaxconnections<br />metermysqlstatusthreadconnected<br />metermysqlconnectsaborted | The number of available connections(connectsavailable)<br/>The number of MySQL instance connection rejections(connectsaborted)| mysqld_exporter| | Connection Errors | | metermysqlconnectionerrorsinternal </br> metermysqlconnectionerrorsmaxconnections | Errors due to exceeding the maxconnections(connectionerrorsmaxconnections) </br>Error caused by internal system(connectionerrorsinternal) | mysqldexporter| | Slow Queries Rate | | metermysqlslowqueriesrate | The rate of slow queries | mysqld_exporter| You can customize your own metrics/expression/dashboard panel. The metrics definition and expression rules are found in `/config/otel-rules/mysql`. The MySQL dashboard panel configurations are found in `/config/ui-initialized-templates/mysql`. SkyWalking leverages or other log agents for collecting slow SQL statements from MySQL/MariaDB. fluentbit agent collects slow sql logs from MySQL/MariaDB. fluentbit agent sends data to SkyWalking OAP Server using native meter APIs via HTTP. The SkyWalking OAP Server parses the expression with to parse/extract and store the results. Set up . Config fluentbit from for MySQL or for MariaDB. Enable slow log from for MySQL or for MariaDB. Slow SQL monitoring provides monitoring of the slow SQL statements of the MySQL/MariaDB server. MySQL/MariaDB server is cataloged as a `Layer: MYSQL` `Service` in OAP. | Monitoring Panel | Unit | Metric Name | Description | Data Source | |--||--|--|--| |Slow Statements | ms | topndatabase_statement | The latency and statement of MySQL/MariaDB slow SQLs | fluentbit| You can customize your own metrics/expression/dashboard panel. The slowsql expression rules are found in `/config/lal/mysql-slowsql.yaml` The MySQL/MariaDB dashboard panel configurations are found in `/config/ui-initialized-templates/mysql`.