Skip to main content

PostgreSQL monitoring with Netdata

PostgreSQL, also known as Postgres, is a free and open-source relational database management system emphasizing extensibility and SQL compliance.

This module monitors one or more Postgres servers, depending on your configuration.

Requirements

  • PostgreSQL v9.4+
  • User with granted pg_monitor or pg_read_all_stat built-in role.

Metrics

All metrics have "postgres." prefix.

MetricScopeDimensionsUnits
connections_utilizationglobalusedpercentage
connections_usageglobalavailable, usedconnections
checkpointsglobalscheduled, requestedcheckpoints/s
checkpoint_timeglobalwrite, syncmilliseconds
bgwriter_buffers_allocglobalallocatedB/s
bgwriter_buffers_writtenglobalcheckpoint, backend, cleanB/s
bgwriter_maxwritten_cleanglobalmaxwrittenevents/s
bgwriter_buffers_backend_fsyncglobalfsyncoperations/s
wal_writesglobalwritesB/s
wal_filesglobalwritten, recycledfiles
wal_archive_filesglobalready, donefiles/s
autovacuum_workersglobalanalyze, vacuum_analyze, vacuum, vacuum_freeze, brin_summarizeworkers
percent_towards_emergency_autovacuumglobalemergency_autovacuumpercentage
percent_towards_txid_wraparoundglobaltxid_wraparoundpercentage
oldest_transaction_xidglobalxidxid
catalog_relation_countglobalordinary_table, index, sequence, toast_table, view, materialized_view, composite_type, foreign_table, partitioned_table, partitioned_indexrelations
catalog_relation_sizeglobalordinary_table, index, sequence, toast_table, view, materialized_view, composite_type, foreign_table, partitioned_table, partitioned_indexB
uptimeglobaluptimeseconds
replication_standby_app_wal_deltastandby applicationsent_delta, write_delta, flush_delta, replay_deltaB
replication_standby_app_wal_lagstandby applicationwrite_lag, flush_lag, replay_lagseconds
replication_standby_app_wal_lagreplication slotwal_keep, pg_replslot_filesfiles
db_transactions_ratiodatabasecommitted, rollbackpercentage
db_transactionsdatabasecommitted, rollbacktransactions/s
db_connections_utilizationdatabaseusedpercentage
db_connectionsdatabaseconnectionsconnections
db_buffer_cache_hit_ratiodatabasehit, misspercentage
db_blocks_readdatabasememory, diskblocks/s
db_rows_read_ratiodatabasereturned, fetchedpercentage
db_rows_readdatabasereturned, fetchedrows/s
db_rows_writtendatabaseinserted, deleted, updatedrows/s
db_conflictsdatabaseconflictsqueries/s
db_conflicts_statdatabasetablespace, lock, snapshot, bufferpin, deadlockqueries/s
db_deadlocksdatabasedeadlocksdeadlocks/s
db_locks_helddatabaseaccess_share, row_share, row_exclusive, share_update, share, share_row_exclusive, exclusive, access_exclusivelocks
db_locks_awaiteddatabaseaccess_share, row_share, row_exclusive, share_update, share, share_row_exclusive, exclusive, access_exclusivelocks
db_temp_filesdatabasewrittenfiles/s
db_temp_files_datadatabasewrittenB/s
db_sizedatabasesizeB

Configuration

Edit the go.d/postgres.conf configuration file using edit-config from the Netdata config directory, which is typically at /etc/netdata.

cd /etc/netdata # Replace this path with your Netdata config directory
sudo ./edit-config go.d/postgres.conf

DSN (Data Source Name) may either be in URL format or key=word format. See Connection Strings for details.

jobs:
- name: local
dsn: 'postgres://postgres:[email protected]:5432/postgres'

- name: local
dsn: 'host=/var/run/postgresql dbname=postgres user=postgres'

- name: remote
dsn: 'postgres://postgres:[email protected]:5432/postgres'

For all available options see module configuration file.

Troubleshooting

To troubleshoot issues with the postgres collector, run the go.d.plugin with the debug option enabled. The output should give you clues as to why the collector isn't working.

First, navigate to your plugins directory, usually at /usr/libexec/netdata/plugins.d/. If that's not the case on your system, open netdata.conf and look for the setting plugins directory. Once you're in the plugin's directory, switch to the netdata user.

cd /usr/libexec/netdata/plugins.d/
sudo -u netdata -s

You can now run the go.d.plugin to debug the collector:

./go.d.plugin -d -m postgres

Was this page helpful?

Contribute