Prometheus exporter for MySQL server metrics. This chart bootstraps a Prometheus mysql exporter deployment on a Kubernetes cluster using the Helm package manager. The exporter can connect to mysql directly or using the Cloud SQL Proxy.
Supported MySQL versions: 5.5 and up.
The Prometheus ecosystem contains a multitude of integrations, both officially supported and third party. Let’s have a look at how to use the mysqld_exporter.
MySQL is a popular database system, which exposes a wide variety of metrics but not in a format Prometheus can directly consume. The mysqld_exporter bridges this gap.
CREATE USER ‘mysqld_exporter’@’localhost’ IDENTIFIED BY ‘a_password’;
GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO ‘mysqld_exporter’@’localhost’
WITH MAX_USER_CONNECTIONS 3;
tar -xzf mysqld_exporter-0.9.0.linux-amd64.tar.gz
export DATA_SOURCE_NAME=’mysqld_exporter:[email protected](/var/run/mysqld/mysqld.sock)/’
You may need to adjust the location of the Unix socket.
If you visit http://localhost:9104/metrics you’ll see your metrics!
Let’s setup a Prometheus to scrape the exporter:
tar -xzf prometheus-2.0.0.linux-amd64.tar.gz
cat <<‘EOF’ > prometheus.yml
– job_name: ‘mysqld’
From there you can go to http://localhost:9090/graph and plot expressions such as irate(mysql_global_status_queries[1m]) to get the query rate.
The mysqld_exporter can provide a wide wealth of information, however, for performance reasons most of this is disabled by default. The official docs have the flags you can use to enable more metrics.
Tell us about a new Kubernetes application
Never miss a thing! Sign up for our newsletter to stay updated.
Discover and learn about everything Kubernetes