Skip to content

pgexporter_ext

Operating-system and host metrics for pgexporter

Overview

PackageVersionCategoryLicenseLanguage
pgexporter_ext0.2.5STATBSD-3-ClauseC
IDExtensionBinLibLoadCreateTrustRelocSchema
6430pgexporter_extNoYesNoYesNoYes-

Release/control and PIGSTY DEB version are 0.2.5; principal PGDG RPM is 0.2.4, except EL8 PG14-16 at 0.2.3. The guide configures preload, but 0.2.5 metrics work without it (verified). Metric access requires pg_monitor; local build capability does not authorize replacing PGDG packages.

Version

TypeRepoVersionPG VerPackageDeps
EXTPGDG0.2.51817161514pgexporter_ext-
RPMPGDG0.2.41817161514pgexporter_ext_$v-
DEBPIGSTY0.2.51817161514postgresql-$v-pgexporter-ext-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64
el8.aarch64
el9.x86_64
el9.aarch64
el10.x86_64
el10.aarch64
d12.x86_64
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
d12.aarch64
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
d13.x86_64
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
d13.aarch64
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
u22.x86_64
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
u22.aarch64
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
u24.x86_64
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
u24.aarch64
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
u26.x86_64
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
u26.aarch64
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5
PIGSTY 0.2.5

Build

You can build the RPM / DEB packages for pgexporter_ext using pig build:

pig build pkg pgexporter_ext         # build RPM / DEB packages

Install

You can install pgexporter_ext directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:

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

Install the extension using pig or apt/yum/dnf:

Install
pig install pgexporter_ext;          # Install for current active PG version
pig
pig ext install -y pgexporter_ext -v 18  # PG 18
pig ext install -y pgexporter_ext -v 17  # PG 17
pig ext install -y pgexporter_ext -v 16  # PG 16
pig ext install -y pgexporter_ext -v 15  # PG 15
pig ext install -y pgexporter_ext -v 14  # PG 14
dnf
dnf install -y pgexporter_ext_18       # PG 18
dnf install -y pgexporter_ext_17       # PG 17
dnf install -y pgexporter_ext_16       # PG 16
dnf install -y pgexporter_ext_15       # PG 15
dnf install -y pgexporter_ext_14       # PG 14
apt
apt install -y postgresql-18-pgexporter-ext   # PG 18
apt install -y postgresql-17-pgexporter-ext   # PG 17
apt install -y postgresql-16-pgexporter-ext   # PG 16
apt install -y postgresql-15-pgexporter-ext   # PG 15
apt install -y postgresql-14-pgexporter-ext   # PG 14

Create Extension:

CREATE EXTENSION pgexporter_ext;

Usage

Sources:

pgexporter_ext exposes Linux host and filesystem metrics through SQL for collection by pgexporter. The examples below apply to the packaged 0.2.3–0.2.5 APIs. Functions run with the PostgreSQL operating-system account’s access, so restrict the monitoring role to trusted users.

Setup and Core Workflow

The upstream setup guide configures the module in shared_preload_libraries, followed by a PostgreSQL restart. Preserve any other libraries already configured.

shared_preload_libraries = 'pgexporter_ext'

In the postgres database, a privileged administrator installs the extension and grants monitoring access to the existing exporter login:

CREATE EXTENSION pgexporter_ext;
GRANT pg_monitor TO pgexporter;

SET ROLE pgexporter;
SELECT pgexporter_version_ext();
SELECT * FROM pgexporter_get_functions();
SELECT * FROM pgexporter_os_info();
SELECT * FROM pgexporter_load_avg();
RESET ROLE;

The SQL scripts revoke public execution and grant it to pg_monitor. That predefined role also grants broad PostgreSQL monitoring access. The release includes a base installation script and an upgrade chain; PostgreSQL can use that chain when installing the default version with CREATE EXTENSION.

Metric Functions

  • pgexporter_information_ext() and pgexporter_version_ext() return extension information and version text.
  • pgexporter_get_functions() lists metric names, whether they take input, descriptions, and types. pgexporter_is_supported(text) checks a metric name.
  • pgexporter_os_info(), pgexporter_cpu_info(), pgexporter_memory_info(), pgexporter_network_info(), and pgexporter_load_avg() return host metrics.
  • pgexporter_used_space(text), pgexporter_free_space(text), and pgexporter_total_space(text) return byte counts for a filesystem path.
SELECT pgexporter_is_supported('pgexporter_load_avg');
SELECT pgexporter_free_space('/var/lib/postgresql');

Choose a path that exists on the server and is accessible to its operating-system account. These releases do not provide the later FIPS or log-count APIs.

Operational Boundaries

Filesystem calls use the server’s filesystem view, which may be a container rather than the host. The used-space function walks directories, so large trees can make scrapes expensive. A pg_monitor member can inspect accessible paths; restrict database access and choose collection paths deliberately.

Upstream lists Linux and PostgreSQL 13+; this catalog supplies packages for PostgreSQL 14–18. Use the exact PostgreSQL-major package. The principal RPM supplier is PGDG at 0.2.4 (EL8 PostgreSQL 14–16 use 0.2.3), while Pigsty supplies DEB 0.2.5; enable the Pigsty repository as well when following the cross-platform installation instructions.

Was this page helpful?