Database Monitoring Setup
Monitoring configs for pg_stat, MySQL Performance Schema, MongoDB Atlas, with Grafana dashboards and alert rules.
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 22 files
📖 Documentation Preview README excerpt
Database Monitoring Setup
A complete, copy-paste monitoring stack for PostgreSQL and MySQL/MariaDB
built on Prometheus + Grafana + the standard exporters. You get a tuned scrape
config, real PromQL alert rules with severities and runbook links, two Grafana
dashboards (valid JSON, importable as-is), exporter setup guides with
least-privilege roles, health-check scripts, and the raw SQL behind every metric.
Most "set up monitoring" tutorials stop at "install the exporter and import a
community dashboard." This kit goes the rest of the way: which metrics actually
predict outages, what thresholds to alert on, and what to do when each alert
fires.
Who this is for
- Engineers/DBAs who run their own PostgreSQL or MySQL and want real visibility.
- Teams adding databases to an existing Prometheus/Grafana setup.
- Anyone tired of finding out the database was at 99% connections after the
outage.
You should be comfortable running an exporter, editing Prometheus/Alertmanager
config, and importing a Grafana dashboard. No paid tooling required.
Contents
database-monitoring-setup/
├── README.md
├── LICENSE
├── monitoring/
│ ├── prometheus.yml # scrape config: postgres/mysql/node exporters
│ ├── alert.rules.yml # PromQL alerts + recording rules, severities
│ └── alertmanager.yml # severity-based routing, grouping, inhibition
├── dashboards/
│ ├── postgresql-overview.json # importable Grafana dashboard (8 panels)
│ └── mysql-overview.json # importable Grafana dashboard (8 panels)
├── exporters/
│ ├── postgres-exporter-setup.md # least-privilege role + systemd + verify
│ ├── postgres-exporter-queries.yaml# custom queries: lag, activity, locks, bloat
│ └── mysqld-exporter-setup.md # least-privilege user + collectors + verify
├── scripts/
│ ├── pg_healthcheck.sh # one-shot PostgreSQL health probe
│ ├── mysql_healthcheck.sh # one-shot MySQL health probe
│ └── replication_check.sh # replica lag / replication-health gate
├── sql/
│ ├── postgres-metric-queries.sql # cache ratio, lag, bloat, locks, slow queries
│ └── mysql-metric-queries.sql # buffer pool, lag, locks, digests
└── docs/
├── key-metrics-guide.md # what to watch and why; good/alert values
└── alerting-runbook.md # one response section per alert
Prerequisites
... continues with setup instructions, usage examples, and more.