{"id":13698557,"url":"https://github.com/percona/mysqld_exporter","last_synced_at":"2025-05-04T03:31:40.555Z","repository":{"id":11493571,"uuid":"66241885","full_name":"percona/mysqld_exporter","owner":"percona","description":"Exporter for MySQL server metrics","archived":false,"fork":true,"pushed_at":"2025-04-25T11:13:26.000Z","size":13520,"stargazers_count":68,"open_issues_count":2,"forks_count":43,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-04-25T12:24:42.138Z","etag":null,"topics":["hacktoberfest","observability","pmm"],"latest_commit_sha":null,"homepage":"http://prometheus.io","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"prometheus/mysqld_exporter","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/percona.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null}},"created_at":"2016-08-22T05:22:36.000Z","updated_at":"2025-04-17T15:09:26.000Z","dependencies_parsed_at":"2023-02-19T17:46:09.987Z","dependency_job_id":"51275e56-7d62-4243-a4b4-f0d3f42abc9c","html_url":"https://github.com/percona/mysqld_exporter","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/percona%2Fmysqld_exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/percona%2Fmysqld_exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/percona%2Fmysqld_exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/percona%2Fmysqld_exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/percona","download_url":"https://codeload.github.com/percona/mysqld_exporter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252283623,"owners_count":21723511,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","observability","pmm"],"created_at":"2024-08-02T19:00:49.491Z","updated_at":"2025-05-04T03:31:35.546Z","avatar_url":"https://github.com/percona.png","language":"Go","funding_links":[],"categories":["Exporters"],"sub_categories":["Percona"],"readme":"# MySQL Server Exporter [![Build Status](https://travis-ci.org/prometheus/mysqld_exporter.svg)][travis]\n\n[![CircleCI](https://circleci.com/gh/prometheus/mysqld_exporter/tree/main.svg?style=shield)][circleci]\n[![Docker Repository on Quay](https://quay.io/repository/prometheus/mysqld-exporter/status)][quay]\n[![Docker Pulls](https://img.shields.io/docker/pulls/prom/mysqld-exporter.svg?maxAge=604800)][hub]\n[![Go Report Card](https://goreportcard.com/badge/github.com/prometheus/mysqld_exporter)](https://goreportcard.com/report/github.com/prometheus/mysqld_exporter)\n\nPrometheus exporter for MySQL server metrics.\n\nSupported versions:\n* MySQL \u003e= 5.6.\n* MariaDB \u003e= 10.3\n\nNOTE: Not all collection methods are supported on MySQL/MariaDB \u003c 5.6\n\n## Building and running\n\n### Required Grants\n\n```sql\nCREATE USER 'exporter'@'localhost' IDENTIFIED BY 'XXXXXXXX' WITH MAX_USER_CONNECTIONS 3;\nGRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'exporter'@'localhost';\n```\n\nNOTE: It is recommended to set a max connection limit for the user to avoid overloading the server with monitoring scrapes under heavy load. This is not supported on all MySQL/MariaDB versions; for example, MariaDB 10.1 (provided with Ubuntu 18.04) [does _not_ support this feature](https://mariadb.com/kb/en/library/create-user/#resource-limit-options).\n\n### Build\n\n    make\n\n### Running\n\nRunning using an environment variable:\n\n    export DATA_SOURCE_NAME='user:password@(hostname:3306)/'\n    ./mysqld_exporter \u003cflags\u003e\n\nRunning using ~/.my.cnf:\n\n    ./mysqld_exporter \u003cflags\u003e\n\nExample format for flags for version \u003e 0.10.0:\n\n    --collect.auto_increment.columns\n    --no-collect.auto_increment.columns\n\nExample format for flags for version \u003c= 0.10.0:\n\n    -collect.auto_increment.columns\n    -collect.auto_increment.columns=[true|false]\n\n### Collector Flags\n\nName                                                         | MySQL Version | Description\n-------------------------------------------------------------|---------------|------------------------------------------------------------------------------------\ncollect.auto_increment.columns                               | 5.1           | Collect auto_increment columns and max values from information_schema.\ncollect.binlog_size                                          | 5.1           | Collect the current size of all registered binlog files\ncollect.engine_innodb_status                                 | 5.1           | Collect from SHOW ENGINE INNODB STATUS.\ncollect.engine_tokudb_status                                 | 5.6           | Collect from SHOW ENGINE TOKUDB STATUS.\ncollect.global_status                                        | 5.1           | Collect from SHOW GLOBAL STATUS (Enabled by default)\ncollect.global_variables                                     | 5.1           | Collect from SHOW GLOBAL VARIABLES (Enabled by default)\ncollect.plugins                                              | 5.1           | Collect from SHOW PLUGINS\ncollect.info_schema.clientstats                              | 5.5           | If running with userstat=1, set to true to collect client statistics.\ncollect.info_schema.innodb_metrics                           | 5.6           | Collect metrics from information_schema.innodb_metrics.\ncollect.info_schema.innodb_tablespaces                       | 5.7           | Collect metrics from information_schema.innodb_sys_tablespaces.\ncollect.info_schema.innodb_cmp                               | 5.5           | Collect InnoDB compressed tables metrics from information_schema.innodb_cmp.\ncollect.info_schema.innodb_cmpmem                            | 5.5           | Collect InnoDB buffer pool compression metrics from information_schema.innodb_cmpmem.\ncollect.info_schema.processlist                              | 5.1           | Collect thread state counts from information_schema.processlist.\ncollect.info_schema.processlist.min_time                     | 5.1           | Minimum time a thread must be in each state to be counted. (default: 0)\ncollect.info_schema.query_response_time                      | 5.5           | Collect query response time distribution if query_response_time_stats is ON.\ncollect.info_schema.replica_host                             | 5.6           | Collect metrics from information_schema.replica_host_status.\ncollect.info_schema.tables                                   | 5.1           | Collect metrics from information_schema.tables.\ncollect.info_schema.tables.databases                         | 5.1           | The list of databases to collect table stats for, or '`*`' for all.\ncollect.info_schema.tablestats                               | 5.1           | If running with userstat=1, set to true to collect table statistics.\ncollect.info_schema.schemastats                              | 5.1           | If running with userstat=1, set to true to collect schema statistics\ncollect.info_schema.userstats                                | 5.1           | If running with userstat=1, set to true to collect user statistics.\ncollect.mysql.user                                           | 5.5             | Collect data from mysql.user table\ncollect.perf_schema.eventsstatements                         | 5.6           | Collect metrics from performance_schema.events_statements_summary_by_digest.\ncollect.perf_schema.eventsstatements.digest_text_limit       | 5.6           | Maximum length of the normalized statement text. (default: 120)\ncollect.perf_schema.eventsstatements.limit                   | 5.6           | Limit the number of events statements digests by response time. (default: 250)\ncollect.perf_schema.eventsstatements.timelimit               | 5.6           | Limit how old the 'last_seen' events statements can be, in seconds. (default: 86400)\ncollect.perf_schema.eventsstatementssum                      | 5.7           | Collect metrics from performance_schema.events_statements_summary_by_digest summed.\ncollect.perf_schema.eventswaits                              | 5.5           | Collect metrics from performance_schema.events_waits_summary_global_by_event_name.\ncollect.perf_schema.file_events                              | 5.6           | Collect metrics from performance_schema.file_summary_by_event_name.\ncollect.perf_schema.file_instances                           | 5.5           | Collect metrics from performance_schema.file_summary_by_instance.\ncollect.perf_schema.file_instances.remove_prefix             | 5.5           | Remove path prefix in performance_schema.file_summary_by_instance.\ncollect.perf_schema.indexiowaits                             | 5.6           | Collect metrics from performance_schema.table_io_waits_summary_by_index_usage.\ncollect.perf_schema.memory_events                            | 5.7           | Collect metrics from performance_schema.memory_summary_global_by_event_name.\ncollect.perf_schema.memory_events.remove_prefix              | 5.7           | Remove instrument prefix in performance_schema.memory_summary_global_by_event_name.\ncollect.perf_schema.tableiowaits                             | 5.6           | Collect metrics from performance_schema.table_io_waits_summary_by_table.\ncollect.perf_schema.tablelocks                               | 5.6           | Collect metrics from performance_schema.table_lock_waits_summary_by_table.\ncollect.perf_schema.replication_group_members                | 5.7           | Collect metrics from performance_schema.replication_group_members.\ncollect.perf_schema.replication_group_member_stats           | 5.7           | Collect metrics from performance_schema.replication_group_member_stats.\ncollect.perf_schema.replication_applier_status_by_worker     | 5.7           | Collect metrics from performance_schema.replication_applier_status_by_worker.\ncollect.slave_status                                         | 5.1           | Collect from SHOW SLAVE STATUS (Enabled by default)\ncollect.slave_hosts                                          | 5.1           | Collect from SHOW SLAVE HOSTS\ncollect.heartbeat                                            | 5.1           | Collect from [heartbeat](#heartbeat).\ncollect.heartbeat.database                                   | 5.1           | Database from where to collect heartbeat data. (default: heartbeat)\ncollect.heartbeat.table                                      | 5.1           | Table from where to collect heartbeat data. (default: heartbeat)\ncollect.heartbeat.utc                                        | 5.1           | Use UTC for timestamps of the current server (`pt-heartbeat` is called with `--utc`). (default: false)\n\n\n### General Flags\nName                                       | Description\n-------------------------------------------|--------------------------------------------------------------------------------------------------\nconfig.my-cnf                              | Path to .my.cnf file to read MySQL credentials from. (default: `~/.my.cnf`)\nlog.level                                  | Logging verbosity (default: info)\nexporter.lock_wait_timeout                 | Set a lock_wait_timeout (in seconds) on the connection to avoid long metadata locking. (default: 2)\nexporter.log_slow_filter                   | Add a log_slow_filter to avoid slow query logging of scrapes.  NOTE: Not supported by Oracle MySQL.\ntls.insecure-skip-verify                   | Ignore tls verification errors.\nweb.config.file                            | Path to a [web configuration file](#tls-and-basic-authentication)\nweb.listen-address                         | Address to listen on for web interface and telemetry.\nweb.telemetry-path                         | Path under which to expose metrics.\nversion                                    | Print the version information.\n\n## TLS and basic authentication\n\nThe MySQLd Exporter supports TLS and basic authentication.\n\nTo use TLS and/or basic authentication, you need to pass a configuration file\nusing the `--web.config.file` parameter. The format of the file is described\n[in the exporter-toolkit repository](https://github.com/prometheus/exporter-toolkit/blob/master/docs/web-configuration.md).\n\n### Setting the MySQL server's data source name\n\nThe MySQL server's [data source name](http://en.wikipedia.org/wiki/Data_source_name)\nmust be set via the `DATA_SOURCE_NAME` environment variable.\nThe format of this variable is described at https://github.com/go-sql-driver/mysql#dsn-data-source-name.\n\n## Customizing Configuration for a SSL Connection\n\nIf The MySQL server supports SSL, you may need to specify a CA truststore to verify the server's chain-of-trust. You may also need to specify a SSL keypair for the client side of the SSL connection. To configure the mysqld exporter to use a custom CA certificate, add the following to the mysql cnf file:\n\n```\nssl-ca=/path/to/ca/file\n```\n\nTo specify the client SSL keypair, add the following to the cnf.\n\n```\nssl-key=/path/to/ssl/client/key\nssl-cert=/path/to/ssl/client/cert\n```\n\nCustomizing the SSL configuration is only supported in the mysql cnf file and is not supported if you set the mysql server's data source name in the environment variable DATA_SOURCE_NAME.\n\n\n## Using Docker\n\nYou can deploy this exporter using the [prom/mysqld-exporter](https://registry.hub.docker.com/r/prom/mysqld-exporter/) Docker image.\n\nFor example:\n\n```bash\ndocker network create my-mysql-network\ndocker pull prom/mysqld-exporter\n\ndocker run -d \\\n  -p 9104:9104 \\\n  --network my-mysql-network  \\\n  -e DATA_SOURCE_NAME=\"user:password@(hostname:3306)/\" \\\n  prom/mysqld-exporter\n```\n\n## heartbeat\n\nWith `collect.heartbeat` enabled, mysqld_exporter will scrape replication delay\nmeasured by heartbeat mechanisms. [Pt-heartbeat][pth] is the\nreference heartbeat implementation supported.\n\n[pth]:https://www.percona.com/doc/percona-toolkit/2.2/pt-heartbeat.html\n\n\n## Filtering enabled collectors\n\nThe `mysqld_exporter` will expose all metrics from enabled collectors by default. This is the recommended way to collect metrics to avoid errors when comparing metrics of different families.\n\nFor advanced use the `mysqld_exporter` can be passed an optional list of collectors to filter metrics. The `collect[]` parameter may be used multiple times.  In Prometheus configuration you can use this syntax under the [scrape config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#\u003cscrape_config\u003e).\n\n```yaml\nparams:\n  collect[]:\n  - foo\n  - bar\n```\n\nThis can be useful for having different Prometheus servers collect specific metrics from targets.\n\n## Example Rules\n\nThere is a set of sample rules, alerts and dashboards available in the [mysqld-mixin](mysqld-mixin/)\n\n[circleci]: https://circleci.com/gh/prometheus/mysqld_exporter\n[hub]: https://hub.docker.com/r/prom/mysqld-exporter/\n[travis]: https://travis-ci.org/prometheus/mysqld_exporter\n[quay]: https://quay.io/repository/prometheus/mysqld-exporter\n[parsetime]: https://github.com/go-sql-driver/mysql#parsetime\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpercona%2Fmysqld_exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpercona%2Fmysqld_exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpercona%2Fmysqld_exporter/lists"}