MySQL receiver ๐
The MySQL receiver queries and retrieves metrics about MySQLโs global status and InnoDB tables. The supported pipeline type is metrics
. See Process your data with pipelines for more information.
Prerequisites and requirements ๐
This receiver supports MySQL version 8.0.
Requirements to collect metrics ๐
The following applies:
To collect most metrics, you need to be able to execute
SHOW GLOBAL STATUS
.Some metrics donโt appear if their corresponding feature is inactive.
To collect optional metrics you must specify them your configuration.
For the full list of available metrics, see Metrics.
Get started ๐
Follow these steps to configure and activate the component:
Deploy the Splunk Distribution of the OpenTelemetry Collector to your host or container platform:
Configure the MySQL receiver as described in the next section.
Restart the Collector.
Sample configuration ๐
To activate the receiver, add mysql
to the receivers
section of your configuration file:
receivers:
mysql:
endpoint: localhost:3306
username: otel
password: ${env:MYSQL_PASSWORD}
database: otel
collection_interval: 10s
initial_delay: 1s
statement_events:
digest_text_limit: 120
time_limit: 24h
limit: 250
Next, include the receiver in the metrics
pipeline of the service
section of your configuration file:
service:
pipelines:
metrics:
receivers:
- mysql
The following settings are optional:
endpoint
.localhost:3306
by default.tls
. Defines the TLS configuration to use. Iftls
is not set, the default is to disable TLS connections.insecure
.false
by default. Set totrue
to disable TLS connections.insecure_skip_verify
.false
by default. Set totrue
to enable TLS but not verify the certificate.server_name_override
. Use this to set the ServerName in the TLSConfig.
username
.root
by default.password
. The password to the username.allow_native_passwords
.true
by default.database
. The database name. If unspecified, metrics are collected for all databases.
collection_interval
.10s
by default. Sets the interval this receiver collects metrics on.This value must be a string readable by Golangโs
time.ParseDuration
. Learn more at Goโs official documentation ParseDuration function .Valid time units are
ns
,us
(orยตs
),ms
,s
,m
,h
.
initial_delay
.1s
by default. Determines how long this receiver waits before collecting metrics for the first time.
transport
.tcp
by default. Defines the network to use to connect to the server.statement_events
. Additional configuration for the queries that buildmysql.statement_events.count
andmysql.statement_events.wait.time
metrics:digest_text_limit
.120
by default. Maximum length ofdigest_text
. Longer text is truncated.time_limit
.24h
by default. Maximum time from since the statements have been observed last time.limit
.250
by default. Limit of records, which is maximum number of generated metrics.
Settings ๐
The following table shows the configuration options for the MySQL receiver:
Name | Type | Default | Description |
---|---|---|---|
collection_interval | int64 | 10s | CollectionInterval sets how frequently the scraper should be called and used as the context timeout to ensure that scrapers don't exceed the interval. |
initial_delay | int64 | 1s | InitialDelay sets the initial start delay for the scraper, any non positive value is assumed to be immediately. |
timeout | int64 | Timeout is an optional value used to set scraper's context deadline. | |
username | string | root | |
password | string | ||
database | string | ||
allow_native_passwords | bool | true | |
endpoint | string | localhost:3306 | |
transport | string | tcp | |
dialer (see fields) | struct | ||
tls (see fields) | struct | ClientConfig contains TLS configurations that are specific to client connections in addition to the common configurations. This should be used by components configuring TLS client connections. | |
metrics (see fields) | struct | MetricsConfig provides config for mysql metrics. | |
resource_attributes (see fields) | struct | ResourceAttributesConfig provides config for mysql resource attributes. | |
statement_events (see fields) | struct |
Fields of dialer
Name | Type | Default | Description |
---|---|---|---|
timeout | int64 |
Fields of tls
Name | Type | Default | Description |
---|---|---|---|
ca_file | string | Path to the CA cert. For a client this verifies the server certificate. For a server this verifies client certificates. If empty uses system root CA. (optional) | |
ca_pem | string | In memory PEM encoded cert. (optional) | |
include_system_ca_certs_pool | bool | false | If true, load system CA certificates pool in addition to the certificates configured in this struct. |
cert_file | string | Path to the TLS cert to use for TLS required connections. (optional) | |
cert_pem | string | In memory PEM encoded TLS cert to use for TLS required connections. (optional) | |
key_file | string | Path to the TLS key to use for TLS required connections. (optional) | |
key_pem | string | In memory PEM encoded TLS key to use for TLS required connections. (optional) | |
min_version | string | MinVersion sets the minimum TLS version that is acceptable. If not set, TLS 1.2 will be used. (optional) | |
max_version | string | MaxVersion sets the maximum TLS version that is acceptable. If not set, refer to crypto/tls for defaults. (optional) | |
cipher_suites | slice | CipherSuites is a list of TLS cipher suites that the TLS transport can use. If left blank, a safe default list is used. See https://go.dev/src/crypto/tls/cipher_suites.go for a list of supported cipher suites. | |
reload_interval | int64 | ReloadInterval specifies the duration after which the certificate will be reloaded If not set, it will never be reloaded (optional) | |
insecure | bool | false | In gRPC and HTTP when set to true, this is used to disable the client transport security. See https://godoc.org/google.golang.org/grpc#WithInsecure for gRPC. Please refer to https://godoc.org/crypto/tls#Config for more information. (optional, default false) |
insecure_skip_verify | bool | false | InsecureSkipVerify will enable TLS but not verify the certificate. |
server_name_override | string | ServerName requested by client for virtual hosting. This sets the ServerName in the TLSConfig. Please refer to https://godoc.org/crypto/tls#Config for more information. (optional) |
Fields of metrics
Name | Type | Default | Description |
---|---|---|---|
mysql.buffer_pool.data_pages | struct | MetricConfig provides common config for a particular metric. | |
mysql.buffer_pool.limit | struct | MetricConfig provides common config for a particular metric. | |
mysql.buffer_pool.operations | struct | MetricConfig provides common config for a particular metric. | |
mysql.buffer_pool.page_flushes | struct | MetricConfig provides common config for a particular metric. | |
mysql.buffer_pool.pages | struct | MetricConfig provides common config for a particular metric. | |
mysql.buffer_pool.usage | struct | MetricConfig provides common config for a particular metric. | |
mysql.client.network.io | struct | MetricConfig provides common config for a particular metric. | |
mysql.commands | struct | MetricConfig provides common config for a particular metric. | |
mysql.connection.count | struct | MetricConfig provides common config for a particular metric. | |
mysql.connection.errors | struct | MetricConfig provides common config for a particular metric. | |
mysql.double_writes | struct | MetricConfig provides common config for a particular metric. | |
mysql.handlers | struct | MetricConfig provides common config for a particular metric. | |
mysql.index.io.wait.count | struct | MetricConfig provides common config for a particular metric. | |
mysql.index.io.wait.time | struct | MetricConfig provides common config for a particular metric. | |
mysql.joins | struct | MetricConfig provides common config for a particular metric. | |
mysql.locks | struct | MetricConfig provides common config for a particular metric. | |
mysql.log_operations | struct | MetricConfig provides common config for a particular metric. | |
mysql.mysqlx_connections | struct | MetricConfig provides common config for a particular metric. | |
mysql.mysqlx_worker_threads | struct | MetricConfig provides common config for a particular metric. | |
mysql.opened_resources | struct | MetricConfig provides common config for a particular metric. | |
mysql.operations | struct | MetricConfig provides common config for a particular metric. | |
mysql.page_operations | struct | MetricConfig provides common config for a particular metric. | |
mysql.prepared_statements | struct | MetricConfig provides common config for a particular metric. | |
mysql.query.client.count | struct | MetricConfig provides common config for a particular metric. | |
mysql.query.count | struct | MetricConfig provides common config for a particular metric. | |
mysql.query.slow.count | struct | MetricConfig provides common config for a particular metric. | |
mysql.replica.sql_delay | struct | MetricConfig provides common config for a particular metric. | |
mysql.replica.time_behind_source | struct | MetricConfig provides common config for a particular metric. | |
mysql.row_locks | struct | MetricConfig provides common config for a particular metric. | |
mysql.row_operations | struct | MetricConfig provides common config for a particular metric. | |
mysql.sorts | struct | MetricConfig provides common config for a particular metric. | |
mysql.statement_event.count | struct | MetricConfig provides common config for a particular metric. | |
mysql.statement_event.wait.time | struct | MetricConfig provides common config for a particular metric. | |
mysql.table.average_row_length | struct | MetricConfig provides common config for a particular metric. | |
mysql.table.io.wait.count | struct | MetricConfig provides common config for a particular metric. | |
mysql.table.io.wait.time | struct | MetricConfig provides common config for a particular metric. | |
mysql.table.lock_wait.read.count | struct | MetricConfig provides common config for a particular metric. | |
mysql.table.lock_wait.read.time | struct | MetricConfig provides common config for a particular metric. | |
mysql.table.lock_wait.write.count | struct | MetricConfig provides common config for a particular metric. | |
mysql.table.lock_wait.write.time | struct | MetricConfig provides common config for a particular metric. | |
mysql.table.rows | struct | MetricConfig provides common config for a particular metric. | |
mysql.table.size | struct | MetricConfig provides common config for a particular metric. | |
mysql.table_open_cache | struct | MetricConfig provides common config for a particular metric. | |
mysql.threads | struct | MetricConfig provides common config for a particular metric. | |
mysql.tmp_resources | struct | MetricConfig provides common config for a particular metric. | |
mysql.uptime | struct | MetricConfig provides common config for a particular metric. |
Fields of mysql.buffer_pool.data_pages
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.buffer_pool.limit
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.buffer_pool.operations
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.buffer_pool.page_flushes
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.buffer_pool.pages
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.buffer_pool.usage
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.client.network.io
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | false |
Fields of mysql.commands
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | false |
Fields of mysql.connection.count
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | false |
Fields of mysql.connection.errors
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | false |
Fields of mysql.double_writes
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.handlers
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.index.io.wait.count
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.index.io.wait.time
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.joins
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | false |
Fields of mysql.locks
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.log_operations
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.mysqlx_connections
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.mysqlx_worker_threads
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | false |
Fields of mysql.opened_resources
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.operations
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.page_operations
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.prepared_statements
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.query.client.count
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | false |
Fields of mysql.query.count
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | false |
Fields of mysql.query.slow.count
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | false |
Fields of mysql.replica.sql_delay
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | false |
Fields of mysql.replica.time_behind_source
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | false |
Fields of mysql.row_locks
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.row_operations
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.sorts
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.statement_event.count
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | false |
Fields of mysql.statement_event.wait.time
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | false |
Fields of mysql.table.average_row_length
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | false |
Fields of mysql.table.io.wait.count
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.table.io.wait.time
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.table.lock_wait.read.count
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | false |
Fields of mysql.table.lock_wait.read.time
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | false |
Fields of mysql.table.lock_wait.write.count
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | false |
Fields of mysql.table.lock_wait.write.time
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | false |
Fields of mysql.table.rows
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | false |
Fields of mysql.table.size
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | false |
Fields of mysql.table_open_cache
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | false |
Fields of mysql.threads
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.tmp_resources
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of mysql.uptime
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true |
Fields of resource_attributes
Name | Type | Default | Description |
---|---|---|---|
mysql.instance.endpoint | struct | ResourceAttributeConfig provides common config for a particular resource attribute. |
Fields of mysql.instance.endpoint
Name | Type | Default | Description |
---|---|---|---|
enabled | bool | true | |
metrics_include (see fields) | slice | Experimental: MetricsInclude defines a list of filters for attribute values. If the list is not empty, only metrics with matching resource attribute values will be emitted. | |
metrics_exclude (see fields) | slice | Experimental: MetricsExclude defines a list of filters for attribute values. If the list is not empty, metrics with matching resource attribute values will not be emitted. MetricsInclude has higher priority than MetricsExclude. |
Fields of metrics_include
Name | Type | Default | Description |
---|---|---|---|
strict | string | ||
regexp | string |
Fields of metrics_exclude
Name | Type | Default | Description |
---|---|---|---|
strict | string | ||
regexp | string |
Fields of statement_events
Name | Type | Default | Description |
---|---|---|---|
digest_text_limit | int | 120 | |
limit | int | 250 | |
time_limit | int64 | 24h0m0s |
Metrics ๐
The following metrics, resource attributes, and attributes, are available.
Name | Type | Unit | Active | Description | Attributes |
---|---|---|---|---|---|
mysql.buffer_pool.pages | Sum | Yes | The number of pages in the InnoDB buffer pool. | ||
mysql.buffer_pool.data_pages | Sum | Yes | The number of data pages in the InnoDB buffer pool. | ||
mysql.buffer_pool.page_flushes | Sum | Yes | The number of requests to flush pages from the InnoDB buffer pool. | ||
mysql.buffer_pool.operations | Sum | Yes | The number of operations on the InnoDB buffer pool. | ||
mysql.buffer_pool.limit | Sum | By | Yes | The configured size of the InnoDB buffer pool. | |
mysql.buffer_pool.usage | Sum | By | Yes | The number of bytes in the InnoDB buffer pool. | |
mysql.prepared_statements | Sum | Yes | The number of times each type of prepared statement command has been issued. | ||
mysql.commands | Sum | No | The number of times each type of command has been executed. | ||
mysql.handlers | Sum | Yes | The number of requests to various MySQL handlers. | ||
mysql.double_writes | Sum | Yes | The number of writes to the InnoDB doublewrite buffer. | ||
mysql.log_operations | Sum | Yes | The number of InnoDB log operations. | ||
mysql.operations | Sum | Yes | The number of InnoDB operations. | ||
mysql.page_operations | Sum | Yes | The number of InnoDB page operations. | ||
mysql.table.io.wait.count | Sum | Yes | The total count of I/O wait events for a table. | ||
mysql.table.io.wait.time | Sum | ns | Yes | The total time of I/O wait events for a table. | |
mysql.table.rows | Sum | No | The number of rows for a given table. | ||
mysql.table.average_row_length | Sum | By | No | The average row length in bytes for a given table. | |
mysql.table.size | Sum | By | No | The table size in bytes for a given table. | |
mysql.index.io.wait.count | Sum | Yes | The total count of I/O wait events for an index. | ||
mysql.index.io.wait.time | Sum | ns | Yes | The total time of I/O wait events for an index. | |
mysql.row_locks | Sum | Yes | The number of InnoDB row locks. | ||
mysql.row_operations | Sum | Yes | The number of InnoDB row operations. | ||
mysql.locks | Sum | Yes | The number of MySQL locks. | ||
mysql.sorts | Sum | Yes | The number of MySQL sorts. | ||
mysql.threads | Sum | Yes | The state of MySQL threads. | ||
mysql.client.network.io | Sum | By | No | The number of transmitted bytes between server and clients. | |
mysql.opened_resources | Sum | Yes | The number of opened resources. | ||
mysql.uptime | Sum | s | Yes | The number of seconds that the server has been up. | |
mysql.table.lock_wait.read.count | Sum | No | The total table lock wait read events. | ||
mysql.table.lock_wait.read.time | Sum | ns | No | The total table lock wait read events times. | |
mysql.table.lock_wait.write.count | Sum | No | The total table lock wait write events. | ||
mysql.table.lock_wait.write.time | Sum | ns | No | The total table lock wait write events times. | |
mysql.connection.count | Sum | No | The number of connection attempts (successful or not) to the MySQL server. | ||
mysql.connection.errors | Sum | No | Errors that occur during the client connection process. | ||
mysql.mysqlx_connections | Sum | Yes | The number of mysqlx connections. | ||
mysql.joins | Sum | No | The number of joins that perform table scans. | ||
mysql.tmp_resources | Sum | Yes | The number of created temporary resources. | ||
mysql.replica.time_behind_source | Sum | s | No | This field is an indication of how โlateโ the replica is. | |
mysql.replica.sql_delay | Sum | s | No | The number of seconds that the replica must lag the source. | |
mysql.statement_event.count | Sum | No | Summary of current and recent statement events. | ||
mysql.statement_event.wait.time | Sum | ns | No | The total wait time of the summarized timed events. | |
mysql.mysqlx_worker_threads | Sum | No | The number of worker threads available. | ||
mysql.table_open_cache | Sum | No | The number of hits, misses or overflows for open tables cache lookups. | ||
mysql.query.client.count | Sum | No | The number of statements executed by the server. This includes only statements sent to the server by clients. | ||
mysql.query.count | Sum | No | The number of statements executed by the server. | ||
mysql.query.slow.count | Sum | No | The number of slow queries. |
Resource Attributes
Name | Type | Description |
---|---|---|
mysql.instance.endpoint | string | Endpoint of the MySQL instance. |
Attributes
Name | Type | Description | Values |
---|---|---|---|
buffer_pool_pages | string | The buffer pool pages types. |
|
buffer_pool_data | string | The status of buffer pool data. |
|
buffer_pool_operations | string | The buffer pool operations types. |
|
prepared_statements_command | string | The prepare statement command types. |
|
command | string | The command types. |
|
connection_error | string | The connection error type. |
|
handler | string | The handler types. |
|
double_writes | string | The doublewrite types. |
|
log_operations | string | The log operation types. |
|
operations | string | The operation types. |
|
page_operations | string | The page operation types. |
|
row_locks | string | The row lock type. |
|
row_operations | string | The row operation type. |
|
locks | string | The table locks type. |
|
sorts | string | The sort count type. |
|
threads | string | The thread count type. |
|
schema | string | The schema of the object. |
|
io_waits_operations | string | The io_waits operation type. |
|
table_name | string | Table name for event or process. |
|
index_name | string | The name of the index. |
|
direction | string | The name of the transmission direction. |
|
digest | string | Digest. |
|
digest_text | string | Text before digestion. |
|
event_state | string | Possible event states. |
|
opened_resources | string | The kind of the resource. |
|
join_kind | string | The kind of join. |
|
read_lock_type | string | Read operation types. |
|
write_lock_type | string | Write operation types. |
|
tmp_resource | string | The kind of temporary resources. |
|
mysqlx_threads | string | The worker thread count kind. |
|
connection_status | string | The connection status. |
|
cache_status | string | The status of cache access. |
|
table_size_type | string | The table size types. |
|
Activate or deactivate specific metrics ๐
You can activate or deactivate specific metrics by setting the enabled
field in the metrics
section for each metric. For example:
receivers:
samplereceiver:
metrics:
metric-one:
enabled: true
metric-two:
enabled: false
The following is an example of host metrics receiver configuration with activated metrics:
receivers:
hostmetrics:
scrapers:
process:
metrics:
process.cpu.utilization:
enabled: true
Note
Deactivated metrics arenโt sent to Splunk Observability Cloud.
Billing ๐
If youโre in a MTS-based subscription, all metrics count towards metrics usage.
If youโre in a host-based plan, metrics listed as active (Active: Yes) on this document are considered default and are included free of charge.
Learn more at Infrastructure Monitoring subscription usage (Host and metric plans).
Troubleshooting ๐
If you are a Splunk Observability Cloud customer and are not able to see your data in Splunk Observability Cloud, you can get help in the following ways.
Available to Splunk Observability Cloud customers
Submit a case in the Splunk Support Portal .
Contact Splunk Support .
Available to prospective customers and free trial users
Ask a question and get answers through community support at Splunk Answers .
Join the Splunk #observability user group Slack channel to communicate with customers, partners, and Splunk employees worldwide. To join, see Chat groups in the Get Started with Splunk Community manual.