add source code and readme
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: postgresql-dashboard-metrics
|
||||
namespace: postgresql-system
|
||||
labels:
|
||||
app: postgresql-shared
|
||||
cnpg.io/reload: ""
|
||||
data:
|
||||
queries: |
|
||||
# Simple replication lag metric
|
||||
pg_replication_lag_seconds:
|
||||
query: |
|
||||
SELECT
|
||||
pg_stat_replication.application_name,
|
||||
pg_stat_replication.client_addr,
|
||||
pg_stat_replication.state,
|
||||
COALESCE(EXTRACT(EPOCH FROM (now() - pg_stat_activity.query_start)), 0) AS lag_seconds
|
||||
FROM pg_stat_replication
|
||||
LEFT JOIN pg_stat_activity ON pg_stat_replication.pid = pg_stat_activity.pid
|
||||
metrics:
|
||||
- application_name:
|
||||
usage: "LABEL"
|
||||
description: "Application name of the standby"
|
||||
- client_addr:
|
||||
usage: "LABEL"
|
||||
description: "IP address of the standby server"
|
||||
- state:
|
||||
usage: "LABEL"
|
||||
description: "Current WAL sender state"
|
||||
- lag_seconds:
|
||||
usage: "GAUGE"
|
||||
description: "Replication lag in seconds"
|
||||
Reference in New Issue
Block a user