pg-replication-metrics-exporter

command module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2023 License: MIT Imports: 16 Imported by: 0

README

Postgres Replication Metrics Exporter

This repository houses pgrm_exporter, a small utility that will connect to all the nodes in a Postgres streaming replication cluster and exports replication lag of each node.

Inspired by: https://github.com/Qarik-Group/pg-replication-tester - thanks 👍

Metrics

  • build_info: Program build info
  • cluster_node_info: Cluster node info
  • reconnects_count_total: Cluster node reconnects total count
  • queries_count_total: All queries total count
  • last_query_seconds: Cluster node last query seconds
  • current_wal_lsn_bytes: SELECT pg_current_wal_lsn()
  • last_wal_receive_lsn_bytes: SELECT pg_last_wal_receive_lsn()
  • last_wal_replay_lsn_bytes: SELECT pg_last_wal_replay_lsn()
  • receive_lag_bytes: Cluster node receive bytes: pg_current_wal_lsn() - pg_last_wal_receive_lsn()
  • replay_lag_bytes: Cluster node replay bytes: pg_last_wal_receive_lsn() - pg_last_wal_reply_lsn()

Options

-A, --address, Address to listens on the TCP network. Default: :9188
-P, --path, Path under which to expose metrics. Default: /metrics
-C, --cluster-name, Cluster name. Default: cluster-hash(nodes)
-n, --node, Replication cluster nodes. May be specified more than once.
-p, --port, TCP port that Postgres listens on. Default: 6432 
-d, --dbname, Database name to connect to. Default: postgres 
-u, --user, User to connect as.
-s, --password, Password to connect with.
-m, --ssl-mode, SSL Mode. Default: disable
-i, --interval, Collecting metrics interval in seconds. Default: 15 
-V, --verbosity, Verbosity level (0 errors, 1 +warnings, 2 +infos, 3 +debugs). Default: 2 
-v, --version, Output version information, then exit.
-h, --help, Show this help, then exit.

Building

GOOS=linux GOARCH=amd64 go build -o pgrm_exporter

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL