Skip to content

pgmonitor

Collector-friendly metric views and background refresh worker

pgmonitor · Collector-friendly metric views and background refresh worker

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
6070pgmonitorpgmonitor2.2.0STATApache-2.0C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--sLd--NoYesYesYesnono
Metric objects work without preloading; the optional background worker requires shared_preload_libraries=pgmonitor_bgw.

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY2.2.019 18 17 16 15pgmonitor-
RPMPIGSTY2.2.019 18 17 16 15pgmonitor_$v-
DEBPIGSTY2.2.019 18 17 16 15postgresql-$v-pgmonitor-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0
el8.aarch64N/APIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0
el9.x86_64PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0
el9.aarch64PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0
el10.x86_64PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0
el10.aarch64PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0
d12.x86_64PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0
d12.aarch64PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0
d13.x86_64PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0
d13.aarch64PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0
u22.x86_64PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0
u22.aarch64PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0
u24.x86_64PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0
u24.aarch64PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0
u26.x86_64PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0
u26.aarch64PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0PIGSTY 2.2.0
PackageVersionOSORGSIZEFile URL
pgmonitor_192.2.0el9.x86_64pigsty46.0 KiBpgmonitor_19-2.2.0-1PGSTY.el9.x86_64.rpm
pgmonitor_192.2.0el9.aarch64pigsty45.7 KiBpgmonitor_19-2.2.0-1PGSTY.el9.aarch64.rpm
pgmonitor_192.2.0el10.x86_64pigsty46.4 KiBpgmonitor_19-2.2.0-1PGSTY.el10.x86_64.rpm
pgmonitor_192.2.0el10.aarch64pigsty45.7 KiBpgmonitor_19-2.2.0-1PGSTY.el10.aarch64.rpm
postgresql-19-pgmonitor2.2.0d12.x86_64pigsty36.8 KiBpostgresql-19-pgmonitor_2.2.0-1PGSTY~bookworm_amd64.deb
postgresql-19-pgmonitor2.2.0d12.aarch64pigsty36.6 KiBpostgresql-19-pgmonitor_2.2.0-1PGSTY~bookworm_arm64.deb
postgresql-19-pgmonitor2.2.0d13.x86_64pigsty36.9 KiBpostgresql-19-pgmonitor_2.2.0-1PGSTY~trixie_amd64.deb
postgresql-19-pgmonitor2.2.0d13.aarch64pigsty36.7 KiBpostgresql-19-pgmonitor_2.2.0-1PGSTY~trixie_arm64.deb
postgresql-19-pgmonitor2.2.0u22.x86_64pigsty39.0 KiBpostgresql-19-pgmonitor_2.2.0-1PGSTY~jammy_amd64.deb
postgresql-19-pgmonitor2.2.0u22.aarch64pigsty38.5 KiBpostgresql-19-pgmonitor_2.2.0-1PGSTY~jammy_arm64.deb
postgresql-19-pgmonitor2.2.0u24.x86_64pigsty38.1 KiBpostgresql-19-pgmonitor_2.2.0-1PGSTY~noble_amd64.deb
postgresql-19-pgmonitor2.2.0u24.aarch64pigsty38.0 KiBpostgresql-19-pgmonitor_2.2.0-1PGSTY~noble_arm64.deb
postgresql-19-pgmonitor2.2.0u26.x86_64pigsty38.1 KiBpostgresql-19-pgmonitor_2.2.0-1PGSTY~resolute_amd64.deb
postgresql-19-pgmonitor2.2.0u26.aarch64pigsty37.9 KiBpostgresql-19-pgmonitor_2.2.0-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pgmonitor_182.2.0el8.x86_64pigsty45.8 KiBpgmonitor_18-2.2.0-1PGSTY.el8.x86_64.rpm
pgmonitor_182.2.0el8.aarch64pigsty45.5 KiBpgmonitor_18-2.2.0-1PGSTY.el8.aarch64.rpm
pgmonitor_182.2.0el9.x86_64pigsty46.1 KiBpgmonitor_18-2.2.0-1PGSTY.el9.x86_64.rpm
pgmonitor_182.2.0el9.aarch64pigsty45.4 KiBpgmonitor_18-2.2.0-1PGSTY.el9.aarch64.rpm
pgmonitor_182.2.0el10.x86_64pigsty46.3 KiBpgmonitor_18-2.2.0-1PGSTY.el10.x86_64.rpm
pgmonitor_182.2.0el10.aarch64pigsty45.7 KiBpgmonitor_18-2.2.0-1PGSTY.el10.aarch64.rpm
postgresql-18-pgmonitor2.2.0d12.x86_64pigsty36.7 KiBpostgresql-18-pgmonitor_2.2.0-1PGSTY~bookworm_amd64.deb
postgresql-18-pgmonitor2.2.0d12.aarch64pigsty36.6 KiBpostgresql-18-pgmonitor_2.2.0-1PGSTY~bookworm_arm64.deb
postgresql-18-pgmonitor2.2.0d13.x86_64pigsty36.8 KiBpostgresql-18-pgmonitor_2.2.0-1PGSTY~trixie_amd64.deb
postgresql-18-pgmonitor2.2.0d13.aarch64pigsty36.6 KiBpostgresql-18-pgmonitor_2.2.0-1PGSTY~trixie_arm64.deb
postgresql-18-pgmonitor2.2.0u22.x86_64pigsty39.0 KiBpostgresql-18-pgmonitor_2.2.0-1PGSTY~jammy_amd64.deb
postgresql-18-pgmonitor2.2.0u22.aarch64pigsty38.5 KiBpostgresql-18-pgmonitor_2.2.0-1PGSTY~jammy_arm64.deb
postgresql-18-pgmonitor2.2.0u24.x86_64pigsty38.0 KiBpostgresql-18-pgmonitor_2.2.0-1PGSTY~noble_amd64.deb
postgresql-18-pgmonitor2.2.0u24.aarch64pigsty37.9 KiBpostgresql-18-pgmonitor_2.2.0-1PGSTY~noble_arm64.deb
postgresql-18-pgmonitor2.2.0u26.x86_64pigsty38.3 KiBpostgresql-18-pgmonitor_2.2.0-1PGSTY~resolute_amd64.deb
postgresql-18-pgmonitor2.2.0u26.aarch64pigsty38.0 KiBpostgresql-18-pgmonitor_2.2.0-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pgmonitor_172.2.0el8.x86_64pigsty45.8 KiBpgmonitor_17-2.2.0-1PGSTY.el8.x86_64.rpm
pgmonitor_172.2.0el8.aarch64pigsty45.5 KiBpgmonitor_17-2.2.0-1PGSTY.el8.aarch64.rpm
pgmonitor_172.2.0el9.x86_64pigsty46.1 KiBpgmonitor_17-2.2.0-1PGSTY.el9.x86_64.rpm
pgmonitor_172.2.0el9.aarch64pigsty45.4 KiBpgmonitor_17-2.2.0-1PGSTY.el9.aarch64.rpm
pgmonitor_172.2.0el10.x86_64pigsty46.3 KiBpgmonitor_17-2.2.0-1PGSTY.el10.x86_64.rpm
pgmonitor_172.2.0el10.aarch64pigsty45.7 KiBpgmonitor_17-2.2.0-1PGSTY.el10.aarch64.rpm
postgresql-17-pgmonitor2.2.0d12.x86_64pigsty36.7 KiBpostgresql-17-pgmonitor_2.2.0-1PGSTY~bookworm_amd64.deb
postgresql-17-pgmonitor2.2.0d12.aarch64pigsty36.5 KiBpostgresql-17-pgmonitor_2.2.0-1PGSTY~bookworm_arm64.deb
postgresql-17-pgmonitor2.2.0d13.x86_64pigsty36.8 KiBpostgresql-17-pgmonitor_2.2.0-1PGSTY~trixie_amd64.deb
postgresql-17-pgmonitor2.2.0d13.aarch64pigsty36.7 KiBpostgresql-17-pgmonitor_2.2.0-1PGSTY~trixie_arm64.deb
postgresql-17-pgmonitor2.2.0u22.x86_64pigsty43.5 KiBpostgresql-17-pgmonitor_2.2.0-1PGSTY~jammy_amd64.deb
postgresql-17-pgmonitor2.2.0u22.aarch64pigsty43.0 KiBpostgresql-17-pgmonitor_2.2.0-1PGSTY~jammy_arm64.deb
postgresql-17-pgmonitor2.2.0u24.x86_64pigsty38.0 KiBpostgresql-17-pgmonitor_2.2.0-1PGSTY~noble_amd64.deb
postgresql-17-pgmonitor2.2.0u24.aarch64pigsty37.9 KiBpostgresql-17-pgmonitor_2.2.0-1PGSTY~noble_arm64.deb
postgresql-17-pgmonitor2.2.0u26.x86_64pigsty38.3 KiBpostgresql-17-pgmonitor_2.2.0-1PGSTY~resolute_amd64.deb
postgresql-17-pgmonitor2.2.0u26.aarch64pigsty38.1 KiBpostgresql-17-pgmonitor_2.2.0-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pgmonitor_162.2.0el8.x86_64pigsty45.7 KiBpgmonitor_16-2.2.0-1PGSTY.el8.x86_64.rpm
pgmonitor_162.2.0el8.aarch64pigsty45.4 KiBpgmonitor_16-2.2.0-1PGSTY.el8.aarch64.rpm
pgmonitor_162.2.0el9.x86_64pigsty46.0 KiBpgmonitor_16-2.2.0-1PGSTY.el9.x86_64.rpm
pgmonitor_162.2.0el9.aarch64pigsty45.4 KiBpgmonitor_16-2.2.0-1PGSTY.el9.aarch64.rpm
pgmonitor_162.2.0el10.x86_64pigsty46.3 KiBpgmonitor_16-2.2.0-1PGSTY.el10.x86_64.rpm
pgmonitor_162.2.0el10.aarch64pigsty45.7 KiBpgmonitor_16-2.2.0-1PGSTY.el10.aarch64.rpm
postgresql-16-pgmonitor2.2.0d12.x86_64pigsty36.7 KiBpostgresql-16-pgmonitor_2.2.0-1PGSTY~bookworm_amd64.deb
postgresql-16-pgmonitor2.2.0d12.aarch64pigsty36.5 KiBpostgresql-16-pgmonitor_2.2.0-1PGSTY~bookworm_arm64.deb
postgresql-16-pgmonitor2.2.0d13.x86_64pigsty36.8 KiBpostgresql-16-pgmonitor_2.2.0-1PGSTY~trixie_amd64.deb
postgresql-16-pgmonitor2.2.0d13.aarch64pigsty36.6 KiBpostgresql-16-pgmonitor_2.2.0-1PGSTY~trixie_arm64.deb
postgresql-16-pgmonitor2.2.0u22.x86_64pigsty43.0 KiBpostgresql-16-pgmonitor_2.2.0-1PGSTY~jammy_amd64.deb
postgresql-16-pgmonitor2.2.0u22.aarch64pigsty42.5 KiBpostgresql-16-pgmonitor_2.2.0-1PGSTY~jammy_arm64.deb
postgresql-16-pgmonitor2.2.0u24.x86_64pigsty38.0 KiBpostgresql-16-pgmonitor_2.2.0-1PGSTY~noble_amd64.deb
postgresql-16-pgmonitor2.2.0u24.aarch64pigsty37.9 KiBpostgresql-16-pgmonitor_2.2.0-1PGSTY~noble_arm64.deb
postgresql-16-pgmonitor2.2.0u26.x86_64pigsty38.3 KiBpostgresql-16-pgmonitor_2.2.0-1PGSTY~resolute_amd64.deb
postgresql-16-pgmonitor2.2.0u26.aarch64pigsty38.1 KiBpostgresql-16-pgmonitor_2.2.0-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pgmonitor_152.2.0el8.x86_64pigsty45.8 KiBpgmonitor_15-2.2.0-1PGSTY.el8.x86_64.rpm
pgmonitor_152.2.0el8.aarch64pigsty45.4 KiBpgmonitor_15-2.2.0-1PGSTY.el8.aarch64.rpm
pgmonitor_152.2.0el9.x86_64pigsty46.1 KiBpgmonitor_15-2.2.0-1PGSTY.el9.x86_64.rpm
pgmonitor_152.2.0el9.aarch64pigsty45.4 KiBpgmonitor_15-2.2.0-1PGSTY.el9.aarch64.rpm
pgmonitor_152.2.0el10.x86_64pigsty46.3 KiBpgmonitor_15-2.2.0-1PGSTY.el10.x86_64.rpm
pgmonitor_152.2.0el10.aarch64pigsty45.7 KiBpgmonitor_15-2.2.0-1PGSTY.el10.aarch64.rpm
postgresql-15-pgmonitor2.2.0d12.x86_64pigsty36.7 KiBpostgresql-15-pgmonitor_2.2.0-1PGSTY~bookworm_amd64.deb
postgresql-15-pgmonitor2.2.0d12.aarch64pigsty36.6 KiBpostgresql-15-pgmonitor_2.2.0-1PGSTY~bookworm_arm64.deb
postgresql-15-pgmonitor2.2.0d13.x86_64pigsty36.8 KiBpostgresql-15-pgmonitor_2.2.0-1PGSTY~trixie_amd64.deb
postgresql-15-pgmonitor2.2.0d13.aarch64pigsty36.6 KiBpostgresql-15-pgmonitor_2.2.0-1PGSTY~trixie_arm64.deb
postgresql-15-pgmonitor2.2.0u22.x86_64pigsty43.0 KiBpostgresql-15-pgmonitor_2.2.0-1PGSTY~jammy_amd64.deb
postgresql-15-pgmonitor2.2.0u22.aarch64pigsty42.6 KiBpostgresql-15-pgmonitor_2.2.0-1PGSTY~jammy_arm64.deb
postgresql-15-pgmonitor2.2.0u24.x86_64pigsty38.0 KiBpostgresql-15-pgmonitor_2.2.0-1PGSTY~noble_amd64.deb
postgresql-15-pgmonitor2.2.0u24.aarch64pigsty37.9 KiBpostgresql-15-pgmonitor_2.2.0-1PGSTY~noble_arm64.deb
postgresql-15-pgmonitor2.2.0u26.x86_64pigsty38.3 KiBpostgresql-15-pgmonitor_2.2.0-1PGSTY~resolute_amd64.deb
postgresql-15-pgmonitor2.2.0u26.aarch64pigsty38.0 KiBpostgresql-15-pgmonitor_2.2.0-1PGSTY~resolute_arm64.deb

Source

github.com/CrunchyData/pgmonitor-extension

pig build pkg pgmonitor;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pgmonitor;		# install by package name

pig install pgmonitor -v 19;   # install for PG 19
pig install pgmonitor -v 18;   # install for PG 18
pig install pgmonitor -v 17;   # install for PG 17
pig install pgmonitor -v 16;   # install for PG 16
pig install pgmonitor -v 15;   # install for PG 15

Config this extension to shared_preload_libraries:

shared_preload_libraries = 'pgmonitor_bgw';

Create this extension with:

CREATE EXTENSION pgmonitor;

Usage

Sources:

pgmonitor exposes PostgreSQL monitoring metrics through a curated set of views, materialized views, and tables for external collectors. Its SQL metrics work without a background worker; the optional pgmonitor_bgw worker periodically refreshes materialized data.

Create the Extension

Create a dedicated schema and install pgmonitor there:

CREATE SCHEMA pgmonitor_ext;
CREATE EXTENSION pgmonitor SCHEMA pgmonitor_ext;

Grant collectors only the access they need to the metric objects. Some underlying PostgreSQL statistics remain subject to built-in role and row-visibility rules.

Collect Metrics

External agents can select the active objects described by the extension’s configuration tables:

SELECT *
FROM pgmonitor_ext.metric_views
WHERE active;

SELECT *
FROM pgmonitor_ext.metric_matviews
WHERE active;

SELECT *
FROM pgmonitor_ext.metric_tables
WHERE active;

These tables describe metric name, activation, scope, and refresh interval. Query the installed definitions rather than assuming every metric is enabled on every PostgreSQL version.

The metric surface includes activity, database and table statistics, locks, replication, WAL and archive status, vacuum progress, settings, checkpoints, and extension-specific views when their dependencies are available.

Refresh Materialized Metrics Manually

Without the background worker, invoke the refresh procedure for the configured schema and metric:

CALL pgmonitor_ext.refresh_metrics(
  'pgmonitor_ext',
  'pg_stat_statements'
);

Use names returned by metric_matviews; do not assume the example metric is installed or active. The extension retains a legacy refresh function for compatibility, but new integrations should use the documented procedure.

Optional Background Worker

To schedule refreshes inside PostgreSQL:

shared_preload_libraries = 'pgmonitor_bgw'
pgmonitor_bgw.dbname = 'postgres,app'
pgmonitor_bgw.role = 'postgres'
pgmonitor_bgw.interval = 30

Restart PostgreSQL after changing shared_preload_libraries. pgmonitor_bgw.dbname is required and lists the databases to maintain. Upstream v2.2 currently requires the worker role to be a superuser; use the narrowest controlled role and protect its credentials and settings.

Object Index

  • metric_views: directly queried metric views and their collection metadata.
  • metric_matviews: materialized metrics and refresh intervals.
  • metric_tables: table-backed metrics and maintenance metadata.
  • refresh_metrics(schema, name): refresh procedure for one configured metric.
  • pgmonitor_bgw.dbname: databases processed by the optional worker.
  • pgmonitor_bgw.role: role used for refresh work.
  • pgmonitor_bgw.interval: worker loop interval in seconds.

Version 2.2 and Caveats

Version 2.2 removes the settings-checksum metric, fixes the legacy refresh path on PostgreSQL 13, and reduces routine log noise.

  • Metric queries add load to shared statistics, catalogs, and extension objects. Set collection intervals from measured cost.
  • A healthy collector connection does not prove materialized views are fresh; monitor their timestamps and worker logs.
  • The extension supplies database metrics, not host, filesystem, or process metrics.
  • Installing pgmonitor does not automatically configure Prometheus, exporters, dashboards, or alert rules.

Table reader