OnCallReadyStart learning

prometheus-postgres-exporter: Prometheus exporter for PostgreSQL server metrics (postgres_exporter 0.19)

prometheus-postgres-exporter [flags]

What it does

Connects to PostgreSQL with DATA_SOURCE_NAME (in /etc/default/prometheus-postgres-exporter) and exposes metrics on :9187/metrics: pg_up, pg_stat_activity_count, pg_settings_*, pg_locks_count, pg_replication_lag_seconds, pg_replication_slot_*, pg_stat_archiver_*, pg_stat_database_*, pg_database_size_bytes, pg_stat_user_tables_*. Give it a role with pg_monitor, not a superuser.

Options you will use

--web.listen-address=":9187"
address on which to expose metrics and web interface.
--web.telemetry-path="/metrics"
path under which to expose metrics.
--collector.stat_statements
enable the stat_statements collector (default: disabled).
--[no-]collector.database
enable the database collector (default: enabled).
--[no-]collector.replication_slot
enable the replication_slot collector (default: enabled).

Examples

$ curl -s localhost:9187/metrics | grep ^pg_up

1 = the exporter reaches PostgreSQL

Try prometheus-postgres-exporter in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.