Skip to content

Monitor

Pigsty ships with a complete observability stack — it's all there once installed. Default endpoints in single-node mode:

ComponentURLDefault account
Grafanahttp://<IP>:3000admin / pigsty
Prometheushttp://<IP>:9090
AlertManagerhttp://<IP>:9093
Loki (logs)Embedded as a Grafana data source

Grafana dashboards

Log in and go to Home → Dashboards, organised by prefix:

  • PGSQL — Cluster / Instance / Database / Query / Session / Replication
  • PGCAT — table / index / extension details via the system catalog
  • PGLOG — slow-query log analysis
  • INFRA — Prometheus, Grafana, Loki themselves
  • NODE — CPU / memory / disk / network
  • REDIS / MINIO / ETCD — dashboards for each module

Dashboards to start with:

  • PGSQL Overview — whole-cluster health at a glance
  • PGSQL Cluster — replica lag, TPS, connection count
  • PGSQL Instance — deep per-instance metrics
  • PGSQL Query — slow queries via pg_stat_statements
  • PGSQL Alert — currently active alerts

Metric sources

SourceDescription
pg_exporter600+ PostgreSQL metrics (custom queries included)
node_exporterHost metrics
patroniHA state
haproxyRouting / health / connections
pgbouncer_exporterPool metrics

See pg_exporter module.


Alerts

Alert rules are preshipped in Prometheus, living at /etc/prometheus/rules/*.yml on each node.

Common default alerts:

  • PostgreSQL primary unreachable
  • Replication lag exceeds threshold
  • Connection count nearing the limit
  • Disk usage > 85%
  • pgBouncer connection backlog

Wire them to webhooks / DingTalk / WeCom by editing the receivers section of alertmanager.yml.


Logs

  • PostgreSQL logs are shipped by promtail into Loki
  • Grafana → Explore → pick the Loki data source → query {cluster="pg-meta"}
  • Structured / slow-query analysis dashboard: PGLOG Analysis

Going deeper

Released under the AGPL 3.0 License