This module periodically fetches metrics from MySQL servers.
The default metricset is
When configuring the
hosts option, you must use a MySQL Data Source Name (DSN)
of the following format:
You can also separately specify the username and password using the respective
configuration options. Usernames and passwords specified in the DSN take
precedence over those specified in the
password config options.
- module: mysql metricsets: ["status"] hosts: ["tcp(127.0.0.1:3306)/"] username: root password: secret
The mysql MetricSets were tested with mysql 5.7.12 and are expected to work with all versions >= 5.7.0.
The mysql module comes with a predefined dashboard. For example:
The MySQL module supports the standard configuration options that are described in Specify which modules to run. Here is an example configuration:
metricbeat.modules: - module: mysql metricsets: ["status"] period: 10s # Host DSN should be defined as "user:pass@tcp(127.0.0.1:3306)/" # The username and password can either be set in the DSN or using the username # and password config options. Those specified in the DSN take precedence. hosts: ["root:secret@tcp(127.0.0.1:3306)/"] # Username of hosts. Empty by default. #username: root # Password of hosts. Empty by default. #password: secret # By setting raw to true, all raw fields from the status metricset will be added to the event. #raw: false
The following metricsets are available: