For the complete documentation index, see llms.txt. This page is also available as Markdown.

MySQL

The MySQL source collects metrics and logs from a MySQL server. Metrics are scraped over a database connection (host/port, a monitoring username and password, transport), covering buffer pool, InnoDB, index, table, connection, replica, and query activity. Logs are read from the general, slow query, and error log files and parsed into structured records. Choose either or both signals with Choose Telemetry Type.

Supported Telemetry Types

Platform
Metrics
Logs
Traces

Linux

Windows

macOS

Prerequisites

For metrics:

  • A reachable MySQL endpoint (host and port, default localhost:3306), or a Unix socket when using the unix transport.

  • A dedicated monitoring user with the minimum privileges the receiver needs. Use a least-privilege account rather than an administrative login. Most metrics require the ability to run SHOW GLOBAL STATUS; performance_schema based metrics (query, statement, and lock-wait timing) additionally require SELECT on performance_schema. Grant REPLICATION CLIENT and PROCESS for replica and process metrics. See Creating MySQL User Accounts for monitoring and the mysqlreceiver README for the exact grants.

  • Network reachability from the collector host to the MySQL port.

For logs:

  • MySQL configured to write the log files you want to collect (general log, slow query log, error log). See MySQL Server Logs.

  • The collector running on the MySQL host (or with access to the log files) and read access to the configured log paths.

Configuration

Bindplane docs - MySQL - image 1

Telemetry Type

Parameter
Type
Required
Default
Description

Choose Telemetry Type

Telemetry Selector

No

["Logs", "Metrics"]

Which signals this source collects: Logs, Metrics, or both.

Logs

Shown when Choose Telemetry Type includes Logs.

Parameter
Type
Required
Default
Description

Enable General Log

Boolean

No

true

Enable to read and parse the general log file.

Enable Slow Log

Boolean

No

true

Enable to read and parse the slow query log.

Enable Error Log

Boolean

No

true

Enable to read and parse the error log.

Metrics

Shown when Choose Telemetry Type includes Metrics.

Parameter
Type
Required
Default
Description

Username

String

Yes

(empty)

Username used to authenticate.

Password

String

Yes

(empty)

Password used to authenticate. Stored as a sensitive value.

Endpoint

String

No

localhost:3306

The endpoint of the MySQL server.

Transport

Enum: tcp, unix

No

tcp

The transport protocol used to connect to MySQL.

Advanced

Parameter
Type
Required
Default
Description

General Log Path

Strings

No

/var/log/mysql/general.log

Path to the general log file(s). Shown when Logs is selected and Enable General Log is true.

Slow Query Log Path

Strings

No

/var/log/mysql/slow*.log

Path to the slow query log file(s). Shown when Logs is selected and Enable Slow Log is true.

Error Log Path

Strings

No

/var/log/mysqld.log, /var/log/mysql/mysqld.log, /var/log/mysql/error.log

Path to the error log file(s). Defaults cover CentOS/RHEL, SLES, and Debian/Ubuntu. Shown when Logs is selected and Enable Error Log is true.

Start At

Enum: beginning, end

No

end

Start reading logs from the beginning or end of the file. Shown when Logs is selected.

Parse

Boolean

No

true

Parses the log fields into structured data. Shown when Logs is selected.

Filtering

Metrics

No

See note

Per-metric enable/disable selection. Some metrics are disabled by default and can be enabled here. Shown when Metrics is selected.

Database

String

No

(empty)

The database name. If not specified, metrics are collected for all databases. Shown when Metrics is selected.

Collection Interval

Integer

No

60

How often (seconds) to scrape for metrics. Shown when Metrics is selected.

The Filtering parameter exposes metrics grouped into Buffer Pool, General, Index, Table, Connection, Replica, and Query categories. Metrics disabled by default include mysql.commands, mysql.client.network.io, the mysql.table.lock_wait.* set, mysql.connection.count, mysql.connection.errors, mysql.joins, mysql.replica.time_behind_source, mysql.replica.sql_delay, mysql.statement_event.count, mysql.statement_event.wait.time, mysql.mysqlx_worker_threads, mysql.table_open_cache, mysql.query.client.count, mysql.query.count, and mysql.query.slow.count.

Examples

Metrics from a remote MySQL server with a monitoring user

Scrape metrics from a remote MySQL instance every 30 seconds using a dedicated monitoring account, with logs disabled.

Logs only from the standard Debian/Ubuntu paths

Collect and parse the general, slow query, and error logs from the default paths, reading new lines as they arrive.

Configuration Tips

  • Use a dedicated, least-privilege monitoring user for metrics rather than an administrative account. Grant only SHOW GLOBAL STATUS access plus SELECT on performance_schema for the query, statement, and lock-wait metrics you intend to enable.

  • The query, statement, and lock-wait metrics are disabled by default. Enable them in Filtering only if your monitoring user has performance_schema access, otherwise they will not populate.

  • Leave Database empty to collect metrics across all databases; set it to scope collection to a single database.

Troubleshooting

Connection refused

Symptoms: the receiver cannot reach the MySQL server.

Solutions:

  1. Verify the Endpoint host and port and that MySQL is listening on it.

  2. Confirm the collector host can reach the port (firewall, security group, bind-address in the MySQL config).

Authentication failed

Symptoms: access-denied errors on connect.

Solutions:

  1. Verify the Username and Password.

  2. Confirm the monitoring user is allowed to connect from the collector's host (the host portion of the MySQL account) and has the required grants.

Query, statement, or lock-wait metrics missing

Symptoms: enabled performance_schema based metrics never appear.

Solutions:

  1. Confirm performance_schema is enabled on the server.

  2. Grant the monitoring user SELECT on performance_schema (and UPDATE on performance_schema.setup_consumers for lock-wait timing).

No logs collected

Symptoms: log files are enabled but no records flow.

Solutions:

  1. Confirm MySQL is writing the relevant log files and the configured paths match.

  2. Verify the collector has read access to the log paths.

Standalone Source

Last updated

Was this helpful?