Prometheus MySQLd Exporter — scrapes a MySQL or MariaDB server and exposes connection, query, InnoDB, and replication metrics for Prometheus. Deployed as a stateless host-networked Nomad service; point it at any reachable server. Pairs with the mariadb and monitoring packs.
Save as values.hcl, edit, then run:
# The name of the Nomad job.
job_name = "mysqld-exporter"
# The Nomad namespace to deploy into.
namespace = "default"
# The datacenters to deploy to.
datacenters = ["*"]
# The Prometheus MySQLd Exporter image. Pin a tag in production.
image = "prom/mysqld-exporter:latest"
# Host port for the exporter (/metrics).
port = 9104
# host:port of the MySQL/MariaDB server to scrape (--mysqld.address). With host networking a co-located mariadb pack is reachable on 127.0.0.1:3306.
mysql_address = "127.0.0.1:3306"
# MySQL user for the exporter (--mysqld.username). Use a dedicated least-privilege monitoring user in production.
mysql_user = "exporter"
# Password for the exporter user (MYSQLD_EXPORTER_PASSWORD).
mysql_password = "exporter"
# Placement constraints. On a nomploy cluster: attribute = "$${meta.nomploy_control_plane}", operator = "=", value = "true".
constraints = []
# The task resources.
resources = {
cpu = 200
memory = 64
}
| Name | Type | Default | Description |
|---|---|---|---|
| job_name | string | "mysqld-exporter" | The name of the Nomad job. |
| namespace | string | "default" | The Nomad namespace to deploy into. |
| datacenters | list | ["*"] | The datacenters to deploy to. |
| image | string | "prom/mysqld-exporter:latest" | The Prometheus MySQLd Exporter image. Pin a tag in production. |
| port | number | 9104 | Host port for the exporter (/metrics). |
| mysql_address | string | "127.0.0.1:3306" | host:port of the MySQL/MariaDB server to scrape (--mysqld.address). With host networking a co-located mariadb pack is reachable on 127.0.0.1:3306. |
| mysql_user | string | "exporter" | MySQL user for the exporter (--mysqld.username). Use a dedicated least-privilege monitoring user in production. |
| mysql_password key | string | "exporter" | Password for the exporter user (MYSQLD_EXPORTER_PASSWORD). |
| constraints | list | [] | Placement constraints. On a nomploy cluster: attribute = "$${meta.nomploy_control_plane}", operator = "=", value = "true". |
| resources | object | {
cpu = 200
memory = 64
} | The task resources. |
No variables match.
Prometheus MySQLd Exporter — scrapes a MySQL or MariaDB server and exposes connection, query, InnoDB, and replication metrics for Prometheus.
Stateless, host-networked Nomad service. Point it at any reachable server; with host networking
a co-located mariadb pack is on 127.0.0.1:3306.
Uses the mysqld_exporter v0.15+ interface (
--mysqld.address/--mysqld.username+MYSQLD_EXPORTER_PASSWORD), which replaced the oldDATA_SOURCE_NAMEenv var.
nomad-pack registry add nomploy https://github.com/Nomploy/nomad-packs
nomad-pack run mysqld-exporter --registry=nomploy
| Variable | Default | Description |
|---|---|---|
port |
9104 |
Host port for /metrics. |
mysql_address |
127.0.0.1:3306 |
Target host:port (--mysqld.address). |
mysql_user |
exporter |
Exporter user (--mysqld.username). |
mysql_password |
exporter |
Exporter password (MYSQLD_EXPORTER_PASSWORD). Change it. |
image |
prom/mysqld-exporter:latest |
Exporter image. Pin a tag in production. |
resources |
{ cpu = 200, memory = 64 } |
Task resources. |
Create a least-privilege monitoring user first:
CREATE USER 'exporter'@'%' IDENTIFIED BY '...' WITH MAX_USER_CONNECTIONS 3;
GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'exporter'@'%';
- job_name: mysql
static_configs:
- targets: ['127.0.0.1:9104']