Skip to content
The Cloudflare Workers Playbook is out — read a free sample first.

Monitoring MariaDB Galera with Prometheus and Grafana

Build an observability stack that sees both the host and the database cluster — with alerts that do not wake you at 3am for nothing.

Published
7 October 2025
Read
2 min read
Written by
SSUSEMAN
Monitoring MariaDB Galera with Prometheus and Grafana
observability — SUSEMANPrometheus · Grafana

A database cluster nobody watches is a cluster that goes down quietly and lets customers find out first. This is the exact stack I run on MariaDB Galera, from node-exporter up to a dashboard that answers "are we okay?" in five seconds.

The pieces

  • Prometheus stores time series and evaluates alert rules
  • node-exporter collects host metrics (CPU, disk, network)
  • mysqld_exporter reads database and Galera status
  • Grafana renders dashboards the ops team actually shares
  • Alertmanager routes to Slack or LINE Notify

A compose file that works

yaml
services:
  prometheus:
    image: prom/prometheus:v2.54.1
    command:
      - --config.file=/etc/prometheus/prometheus.yml
      - --storage.tsdb.retention.time=30d
    volumes: ['./prometheus.yml:/etc/prometheus/prometheus.yml:ro', 'prom-data:/prometheus']
    ports: ['9090:9090']

  grafana:
    image: grafana/grafana:11.1.0
    environment:
      GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD}
    volumes: ['grafana-data:/var/lib/grafana']
    ports: ['3000:3000']

Expose MySQL metrics through a dedicated least-privilege user:

sql
CREATE USER 'exporter'@'10.%' IDENTIFIED BY 'strong-secret' WITH MAX_USER_CONNECTIONS 3;
GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'exporter'@'10.%';

The metrics that actually matter

There are thousands of series, but only a handful ever got me out of bed successfully:

Metric Meaning Threshold
wsrep_cluster_size Nodes still in the cluster below 3
wsrep_ready Node accepting writes equals 0
wsrep_flow_control_paused Share of time throttled above 0.05
mysql_global_status_threads_connected Open connections above 80% of max
node_filesystem_avail_bytes Free disk below 15%

Alerts that respect sleep

Rule of thumb: a 3am page must be something a human can fix at 3am. Capacity issues belong in a Slack channel during business hours.

yaml
groups:
  - name: galera
    rules:
      - alert: GaleraClusterDegraded
        expr: wsrep_cluster_size < 3
        for: 2m
        labels: { severity: critical }
      - alert: DiskAlmostFull
        expr: node_filesystem_avail_bytes / node_filesystem_size_bytes < 0.15
        for: 30m
        labels: { severity: warning }

Two years of hindsight

Prometheus disk is the classic blind spot. Thirty days of millions of series consumes real storage — set an explicit retention and mount a separate volume.

Keep labels disciplined. If instance is sometimes an IP and sometimes a hostname, every query becomes a archaeology project later. Use the hostname as the source of truth and keep the IP as a secondary label.

And a good dashboard is not the one filling the screen with graphs — it is the one that says whether the system is healthy within the first five seconds.

S

Written by

SUSEMAN · Infrastructure engineer · Writer

A journal of cloud & web engineering · Bangkok, Thailand

About →

The weekly dispatch

New articles, tools worth testing and lessons from production — every Thursday. No spam, ever.

No spam. Unsubscribe anytime.

Related reading

View all →

Next article

Auto vs predictive scaling: scale before the load, not after it

→