Skip to content

Monitoring

Peat does not run a monitoring stack for you. Every piece publishes its numbers in the Prometheus format, and the repository carries what plugs them into the stack you already have: the objects that tell a Prometheus what to read, a Grafana dashboard, and a set of alerts. They are in control/examples/monitoring.

Without any of it, peat status still tells you in words whether the platform is healthy and what it is waiting for.

A Prometheus and, for the dashboard, a Grafana. If your cluster has neither, the usual way to get both is the kube-prometheus-stack chart:

Terminal window
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm install kube-prometheus-stack prometheus-community/kube-prometheus-stack -n monitoring --create-namespace

Peat’s network rules let each piece be read only from a namespace that carries one label. Put it on the namespace your Prometheus runs in:

Terminal window
kubectl label namespace monitoring peat.zabaca.com/scrape=true
Terminal window
kubectl apply -f https://raw.githubusercontent.com/Zabaca/peat/main/control/examples/monitoring/podmonitors.yaml

This makes four PodMonitor objects, for the storage pieces, the control layer, the gateways and the operator. They need the Prometheus Operator at version 0.75 or newer, which kube-prometheus-stack includes.

One thing to check: a Prometheus only picks up monitors that carry the label it looks for. The file uses release: kube-prometheus-stack, which fits the chart installed under that name. If yours differs, download the file and change the label. This prints what your Prometheus looks for:

Terminal window
kubectl get prometheus -A -o jsonpath='{.items[*].spec.podMonitorSelector}'

Within a minute the Prometheus should list eight or more Peat targets as up (Status, then Targets, in its own page).

No Prometheus Operator? Any Prometheus, or an OpenTelemetry collector with its Prometheus receiver, can read the same pages. Each piece answers GET /metrics on its pod:

PieceNamespacePod labelPort
Pageserverspeatapp=pageserver9898
Safekeeperspeatapp=safekeeper7676
Storage controllerpeatapp=storage-controller1234
Control layerpeatapp=peat-control8080
Gatewayspeat-gatewayapp=peat-gateway9090
Operatorpeat-systemapp=peat-operator8081

The dashboard and the alerts expect each piece’s job label to be its pod label’s value (pageserver, safekeeper and so on) and a pod label with the pod’s name.

Import dashboard.json into Grafana (Dashboards, New, Import) and pick your Prometheus as its data source. It has five parts:

  • Is it healthy: the platform’s state, pieces down, safekeepers, pageservers and gateways up, machines counted dead, and whether an upgrade is halted.
  • Databases: open sessions and new connections by database, wakes and sleeps, how long a wake takes, and each database’s size.
  • Compute used: how many compute units are awake, the unit-hours used over the time range and by database, and what a unit-hour cost you. See below.
  • Storage: data in the bucket and on the machines, write-ahead log not yet uploaded, requests to the bucket and their errors, how fast pages are read, and where databases are served.
  • The pieces themselves: memory and CPU of each pod.

Every panel has a note (the small “i”) saying what it shows and what is normal.

A usage-priced service bills compute by the unit-hour: one unit, 1 vCPU and 4 GB of memory, awake for an hour. On your own machines you pay for the machines whether databases are awake or not, so your cost for a unit-hour depends on how much of them you use.

The control layer reports each awake database and the memory its compute may use (peat_database_awake, peat_database_compute_memory_bytes; a sleeping database reports nothing). The dashboard adds them up, counting 4 GB as one unit:

  • Unit-hours over the time range you pick, in total and by database. Set the range to 30 days for a month’s use.
  • Your cost per unit-hour: type what your machines cost a month into the box at the top of the dashboard. The panel divides that, for the time shown, by the unit-hours used.

The same numbers are what you would bill your own users by.

Terminal window
kubectl apply -f https://raw.githubusercontent.com/Zabaca/peat/main/control/examples/monitoring/alerts.yaml

The same label applies as for the monitors. Each alert is something a person should look at:

AlertMeans
PeatPieceDownA pod of the platform has not answered for 3 minutes.
PeatNotMonitoredThe monitor sees no storage piece or gateway at all.
PeatUpgradeHaltedAn upgrade stopped at a failed check and waits for peat retry or the earlier release.
PeatPlatformFailedThe Platform reads Failed.
PeatOperatorNotActing, PeatOperatorPassesFailingNothing is keeping the platform as declared.
PeatSafekeeperDownOne safekeeper is down; the next loss stops writes.
PeatWritesAtRiskTwo safekeepers are down: with three, databases cannot commit.
PeatSafekeeperGone, PeatSafekeeperReplacementBlockedA lost safekeeper is not being replaced.
PeatMachineDeadA machine is unreachable and treated as lost.
PeatControlLayerNoLeaderNo control layer pod is acting, or more than one.
PeatDatabasesNotAttachedDatabases that no pageserver serves.
PeatStorageControllerStuckA move of a database between pageservers has not finished.
PeatBucketErrorsOver 5% of requests to the object store are failing.
PeatLogNotReachingBucketOver 1 GB of a database’s log has not reached the bucket for 30 minutes.
PeatWakesFailing, PeatWakesSlowSleeping databases do not wake in time.

Where they are sent (a pager, chat, email) is your Alertmanager’s own setting.

  • The machines’ disks. Peat’s pieces do not report how full the disk under /var/lib/peat is. Watch it with your node monitoring (kube-prometheus-stack’s node exporter does); a full disk stops a pageserver or a safekeeper.
  • Inside a database. Query counts, slow queries and locks are Postgres’s own; use pg_stat_statements or a Postgres exporter pointed at the database.
  • A database’s name in the storage panels. The storage knows a database by its tenant id. kubectl get database <name> -o yaml shows it.
  • The platform’s state (the first panel and two alerts) and the compute used panels need a release newer than release-2026-11-29.