From PostgreSQL wiki
PostgreSQL builtin & contrib
PostgreSQL collects lots of data on its own and offers it via the pg_stat(io)_ system views
The following extensions offer access to Postgres internals which may be of interest or collect additional information. Most of them are shipped with Postgres (the -contrib packages may need to be installed) and can be activated via the extension interface.
pg_stat_statements tracks all queries that are executed on the server and records average runtime per query "class" among other parameters.
Monitoring PostgreSQL with Munin
- PostgreSQL Plugins developed in Perl are included in the Core Munin Distribution. The following plugins are included by default: postgres_bgwriter, postgres_locks_, postgres_tuples_, postgres_cache_, postgres_querylength_, postgres_users, postgres_checkpoints, postgres_scans_, postgres_xlog, postgres_connections_, postgres_size_, postgres_connections_db, postgres_transactions_.
- PyMunin - Multigraph Munin Plugins in Python - PyMunin includes a Multigraph Munin Plugin for PostgreSQL that implements the following graphs: pg_connections, pg_diskspace, pg_blockreads, pg_xact, pg_tup_read, pg_tup_write, pg_blockreads_detail, pg_xact_commit_detail, pg_xact_rollback_detail, pg_tup_return_detail, pg_tup_fetch_detail, pg_tup_delete_detail, pg_tup_update_detail, pg_tup_insert_detail.
- PostgreSQL Monitoring With Munin. Detailed setup instructions for common Linux platforms.
Useful for network management systems which are limited to SNMP protocol.