MySQL integration for Grafana Cloud
MySQL is a managed, open source relational database management system. The MySQL integration enables you to automatically scrape and send metrics and logs from MySQL databases to Grafana Cloud. This integration includes useful prebuilt dashboards, alerts, and recording rules to help you monitor relevant metrics and logs.
Before you begin
This integration enables Grafana Agent to send MySQL metrics and logs to Grafana Cloud.
- MySQL >= 5.6.
- MariaDB >= 10.2
Install MySQL integration for Grafana Cloud
- In your Grafana instance, click Integrations and Connections (lightning bolt icon), then click on the MySQL tile to install the integration.
- Once the integration is installed, follow the steps on the Configuration Details page to configure the Grafana agent to automatically scrape and send MySQL metrics and logs to your Grafana cloud instance.
Post-install configuration for the MySQL integration
This integration supports metrics and logs from MySQL. In order to see those signals correlated on the same dashboard,
instance labels must match for
logs in the agent configuration file:
metrics: wal_directory: /tmp/wal logs: configs: - name: agent clients: - url: http://loki:3100/loki/api/v1/push positions: filename: /tmp/positions.yaml target_config: sync_period: 10s scrape_configs: - job_name: integrations/mysql static_configs: - labels: instance: mysql-01 job: integrations/mysql __path__: /var/log/mysql/*.log pipeline_stages: - regex: expression: '(?P<timestamp>.+) (?P<thread>[\d]+) \[(?P<label>.+?)\]( \[(?P<err_code>.+?)\] \[(?P<subsystem>.+?)\])? (?P<msg>.+)' - labels: label: err_code: subsystem: - drop: expression: '^ *$' drop_counter_reason: 'drop empty lines' integrations: prometheus_remote_write: - url: http://cortex:9009/api/prom/push mysqld_exporter: enabled: true instance: mysql-01 data_source_name: 'root:put-password-here@(localhost:3306)/' relabel_configs: - source_labels: [__address__] target_label: job replacement: 'integrations/mysql'
It’s recommended to configure a separate user for the agent to give it only the strictly mandatory security privileges necessary for monitoring your node. For more information, see the MySQL Server Exporter documentation.
Tip: If you set the
MYSQL_ALLOW_EMPTY_PASSWORDflag then you can omit the password in the
data_source_name options, refer to the MySQL section of the go-sql-driver README.
After you have successfully configured the MySQL integration, two prebuilt dashboards will be installed in your Grafana instance to help you monitor your MySQL metrics and logs.
MySQL overview dashboard
This dashboard gives a general overview of all relevant metrics from your MySQL instance, such as uptime, connections, thread cache, and more.
MySQL logs dashboard
This dashboard contains statistics of the logs collected by Grafana Agent through MySQL. It contains panels that surface errors, warnings, and complete log files in separate views.
Grafana Cloud alerts are directly tied to metrics and log data. This integration includes the following useful alerts:
MySQL is down: Continuously checks the availability of MySQL service
Galera Alerts: Monitors the health of Galera cluster
Metrics captured by MySQL integration for Grafana Cloud
For a complete list of all metrics provided by MySQL integration, refer MySQL Prometheus metrics.
The most important metrics provided are as follows:
- MySQL uptime
- Queries per second
- InnoDB Buffer Pool
- Max connections
- Max used connections
- Avg threads running
- Peak threads running
- MySQL questions
- Thread cache size
- Threads cached
- Threads created
- Tmp tables created
- Tmp files created
- Tmp disk tables created
- MySQL sorts
- MySQL slow queries
- MySQL aborted connections
- MySQL table locks waited
- MySQL table locks immediate
- MySQL network outbound traffic
- MySQL network inboud traffic
- MySQL key buffer size
- MySQL InnoDB log buffer size
- MySQL InnoDB buffer pool data
- MySQL InnoDB dictionary size
- MySQL InnoDB open files
- MySQL query cached size
- MySQL top commands executed
- MySQL query cache memory size
- MySQL query cache free memory
- MySQL queries in cache
- MySQL cache prunes
- MySQL file openings
- MySQL open files limit
- MySQL open files
- MySQL table open cache misses due to overflows
- MySQL table open cache misses
- MySQL table open cache hits
- MySQL table open cache openings
- MySQL table open cache hit ratio
- MySQL table definitions cache size
- MySQL open table definitions
By connecting your MySQL integration to Grafana Cloud you might incur charges. For more information, use the following links:
- For an increase in the number of active series that your Grafana Cloud account uses for metrics included in each Cloud tier, see Active series and dpm usage and Cloud tier pricing.
- See MySQL Products for cost information associated with MySQL.