List of Information and Metrics Collected
The information and metrics collected (and reported) by
pgmetrics are listed
below. Some values are only available in certain PostgreSQL versions and above.
A notation like “v9.6+” indicates that the value is available only in PostgreSQL
version 9.6 and above. Note that versions 9.2 and below are not supported by
The collected information falls into three categories:
This section lists the cluster-level information, which is always collected
irrespective of the number of databases specified on the command line.
Note: Technically, a single running PostgreSQL server manages a
of databases. Not to be confused with the a set of co-operating servers.
- system identifier - v9.6+
- last commit - the last committed transaction ID and timestamp, if the
option is set to
- checkpoint/prior/redo locations - v9.6+
- time of last checkpoint - v9.6+
- timeline ID - v9.6+
- oldest/next/oldest-active transaction IDs - v9.6+
- settings - entries from pg_settings
- pg_stat_activity - the entries from pg_stat_activity. Detailed waiting-for-lock
information is available only in v9.6+. PostgreSQL-internal backend information
present in v10+ is currently not collected.
- pg_stat_archiver - the entries from pg_stat_archiver. v9.4+
- pg_stat_bgwriter - the entries from pg_stat_bgwriter.
- pg_stat_replication - the entries from pg_stat_replication. This gives
details of outgoing replication.
- pg_stat_wal_receiver - the entries from pg_stat_wal_receiver. This gives
details of incoming replication. v9.6+
- pg_replication_slots - the entries from pg_replication_slots. This gives
details of physical and logical replication slots. v9.4+
- last received/replayed location - in recovery mode
- last replayed timestamp - in recovery mode
- is in recovery mode?
- is WAL replay paused?
- current wal/wal insert/wal flush locations - v9.6+
- publications, subscriptions - v10+ (added in pgmetrics v1.4)
- pg_stat_progress_vacuum - the entries from pg_stat_progress_vacuum. v9.6+
The information about all databases, except template databases, are fetched
from pg_stat_database. For each database, the size as reported by the
pg_database_size() function is also collected.
Note that it is possible to skip the collection of the size using a
The OID, name and location of each tablespace is collected from pg_tablespace.
For the default tablespaces pg_global and pg_default, the value of the PostgreSQL
database directory ($PGDATA) is used.
The size, as reported by
pg_tablespace_size() is also collected. It is possible
to skip this.
The list of roles and associated attributes are collected from pg_auth_members
- number of WAL files in the pg_xlog (pg_wal in v10+) directory
- number of .ready files in the pg_xlog/archive_status (pg_wal/archive_status in v10+) directory
- notification queue usage - v9.6+
This section lists the database-level information, which is collected
for each database that is specified on the command line.
- pg_stat_user_tables - entries from pg_stat_user_tables for all user tables
in the database
- pg_statio_user_tables - entries from pg_statio_user_tables for all
user tables in the database
- pg_table_size - size information for each table as reported by the
pg_table_size() function, can be skipped
- pg_stat_user_indexes - entries from pg_stat_user_indexes for all
user indexes in the database
- pg_total_relation_size - size information for each index as reported by
pg_total_relation_size() function, can be skipped
- pg_statio_user_sequences - entries from pg_statio_user_sequences for all
sequences in the database
- pg_stat_user_functions - entries from pg_stat_user_functions for all
tracked user functions. This will have information only if the
option is enabled in PostgreSQL configuration.
- pg_available_extensions - the name, installed/default versions and comment
for each extension in the database, read from pg_available_extensions
- disabled triggers - the trigger and procedure name for each disabled
trigger in the database, read from pg_trigger and pg_proc
- pg_stat_statements - the slowest 100 queries (this number can be set as
a command-line parameter) as reported by pg_stat_statments
- publications, subscriptions - the logical replication publications and
subscriptions in this database, PostgreSQL v10+ (added in pgmetrics v1.4)
- bloat - the estimated bloat for each table and index, using the same query
from Greg Sabino Mullane’s check_postgres
pgmetrics is run directly on the system where the PostgreSQL server is
running, it can collect additional system-level information from the OS.
Currently, this is done only for Linux systems.
- hostname - the hostname of the system
- disk/inodes used/total - for each tablespace location, including the disk
- cpu - the count and model of the CPU cores
- load average - the 1-minute load average
- memory free/buffers/cached/used - the RAM usage
- swap used/free - the swap usage