PGD Monitor is a built-in monitoring web application served by every PGD node. It runs as a background worker inside the Postgres instance, requiring no separate installation, deployment, or database connection. It provides:
- a web UI for interactive troubleshooting
- a JSON REST API under
/api/v1/, exposing the same data the UI renders - a Prometheus scrape endpoint at
/metrics, for feeding an existing observability stack - health probes at
/is-liveand/is-readyfor orchestration
PGD Monitor doesn't replace the SQL-level monitoring interfaces covered in Monitoring through SQL. It builds on top of those, plus the standard Postgres statistics views, through a shared metric registry. See Monitoring metrics reference for the full list of metrics this registry collects, and bdr.ts_metrics() for querying it directly over SQL.
Enabling and configuring PGD Monitor
Enable PGD Monitor on every node that will serve it:
- Set
bdr.monitor_enabledtoonin the node'spostgresql.conf, or runALTER SYSTEM SET bdr.monitor_enabled = 'on'. - Reload the configuration:
SELECT pg_reload_conf();. No restart is required.
Once enabled, the HTTP server listens on the same addresses as Postgres, on a port 1005 higher than the Postgres port by default. For example, a node running Postgres on port 5432 serves PGD Monitor on port 6437.
To use a different port or turn on HTTPS, set the monitor_http_port and monitor_use_https node group options with bdr.alter_node_group_option. Unlike bdr.monitor_enabled, these settings are node group options, set once and inherited by every member node. For example:
SELECT bdr.alter_node_group_option('top_group', 'monitor_http_port', '8443'); SELECT bdr.alter_node_group_option('top_group', 'monitor_use_https', 'true');
HTTPS reuses the server's SSL certificate configuration by default. To use different certificate files, set bdr.monitor_ssl_cert_file, bdr.monitor_ssl_key_file, and bdr.monitor_ssl_ca_file on each node individually, then reload the configuration.
Using PGD Monitor
- Using the web UI to monitor your cluster interactively
- Using Prometheus to scrape metrics into an existing observability stack
You can also authenticate against the REST API with a Postgres role name and password, using a role that's a member of Postgres's pg_monitor predefined role, or a superuser. The REST API may change between releases, so treat the following as best-effort rather than a stable integration point:
# Log in and save the session cookie. curl -c cookies.txt -X POST https://node1.example.com:6437/api/v1/login \ -H "Content-Type: application/json" \ -d '{"username": "monitoring_role", "password": "..."}' # Reuse the cookie for subsequent authenticated requests. curl -b cookies.txt https://node1.example.com:6437/api/v1/cluster/health