prometheus-mysql-exporter
by braedon
Run queries on Mysql and export the results as Prometheus metrics.
About this chart
Prometheus MySQL Exporter
This Prometheus exporter periodically runs configured queries against a MySQL server and exports the results as Prometheus gauge metrics.
Source Code | Python Package | Docker Image | Helm Chart
Installation
Deploy prometheus-mysql-exporter on a Kubernetes cluster with the default configuration:
helm repo add braedon https://braedon.github.io/helm
helm repo update
helm install braedon/prometheus-mysql-exporter --name <release name> \
--set mysql.server=<mysql server address> \
--set image.tag=<image tag>
Specify configuration via a YAML file:
helm install braedon/prometheus-mysql-exporter --name <release name> -f <config file>.yaml
Configuration
Available configurable parameters and their default values.
| Parameter | Description | Default |
|---|---|---|
mysql.server | address of mysql server to run queries on | none |
mysql.cred.secret | name of the user credentials secret, if required | none |
mysql.cred.usernameKey | username key in credentials secret | username |
mysql.cred.passwordKey | password key in credentials secret | password |
mysql.localTimezone | local timezone for SQL commands like NOW() | none |
mysql.queries | mysql queries to run | see values.yaml |
deployment.replicas | exporter pod replicas to deploy | 1 |
pod.annotations | annotations to add to the exporter pods | {} |
pod.extraVolumes | extra volumes to pass to the exporter pod | [] |
image.repository | exporter docker image repository | braedon/prometheus-mysql-exporter |
image.tag | exporter docker image tag | none |
image.pullPolicy | exporter docker image pull policy | IfNotPresent |
container.port | exporter container metrics port | 9206 |
container.portName | exporter container metrics port name | prometheus |
container.extraArgs | extra arguments to pass to the exporter container | [] |
container.extraEnv | extra env vars to pass to the exporter container | [] |
container.extraVolumeMounts | extra volume mounts to pass to the exporter container | [] |
container.resources | exporter container resource requests & limits | {} |
nodeSelector | node labels for exporter pod assignment | {} |
tolerations | node taints to tolerate (requires Kubernetes >=1.6) | [] |
affinity | node/pod affinities (requires Kubernetes >=1.6) | {} |
service.port | exporter service port | 9206 |
service.portName | exporter service port name | prometheus |
service.annotations | annotations to add to the exporter service | {} |
See the exporter README for details on the format of exporter options like mysql.server.
See the example query config file for examples and explanations of query configurations for mysql.queries.
Deploy prometheus-mysql-exporter with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has prometheus-mysql-exporter on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartprometheus-mysql-exporter is pinned at v0.2.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply