resources
resources · Linux server resource monitoring views backed by file_fdw PROGRAM foreign tables.
Overview
PostgreSQL · 10, 11, 12, 13, 14, 15, 16, 17, 18
| Relationships | |
|---|---|
| Requires | file_fdw |
Usage
Sources:
resources is a Linux-specific set of file_fdw program-backed foreign tables and views for reading CPU, memory, operating-system, filesystem, and PostgreSQL-process information. Each scan runs a fixed shell pipeline on the database server. Upstream warns that the existing version contains bugs.
Core Workflow
Install only on a compatible Linux host as a superuser, then query the precreated objects:
No application data is stored in these foreign tables; results are parsed from commands such as cat, awk, top, lscpu, df, and ps at query time.
Important Objects
resources.cpu_loadavgandresources.cpu_useexpose load averages and CPU-state output.resources.distributionandresources.lscpuexpose kernel and CPU information.resources.meminfoconverts Linux memory information to gigabytes.resources.partitionsparses filesystem utilization.resources.ps_postgresandresources.ps_postgresv2parse processes owned by the hard-coded operating-system user postgres.resources.v_ps_postgresandresources.v_ps_postgresv2join process output with PostgreSQL activity data.
Security and Portability Notes
Program-backed file_fdw tables execute operating-system commands with the PostgreSQL service account and therefore require highly privileged setup and access. Revoke foreign-table and server access from untrusted roles. Output formats vary by Linux distribution, locale, command version, cgroup/container environment, and service-account name, so parsing can fail or silently mislabel columns. Some commands sleep or scan process/filesystem state on every query. Do not expose these views as a portable monitoring API; prefer a maintained host exporter outside PostgreSQL.