Skip to content

migration from postgres_exporter #313

Closed Answered by burningalchemist
kevinwincott asked this question in Q&A
Discussion options

You must be logged in to vote

@kevinwincott For instance, the metric below:

pg_replication:
   query: "SELECT CASE WHEN NOT pg_is_in_recovery() THEN 0 ELSE GREATEST (0, EXTRACT(EPOCH FROM (now() - pg_last_xact_replay_timestamp()))) END AS lag"
   master: true
   metrics:
     - lag:
         usage: "GAUGE"
         description: "Replication lag behind master in seconds"

might be configured as follows:

metrics:
      - metric_name: pg_replication
        type: gauge
        help: 'Total number of times the transaction log has been expanded since last restart, per database.'
        values: [lag]
        query: |
          SELECT CASE WHEN NOT pg_is_in_recovery()
          THEN 0
          ELSE GREATEST (0, EXTRACT(EPO…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@burningalchemist
Comment options

Answer selected by burningalchemist
@ridvankorkmaz
Comment options

@keithf4
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants