-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy path0110-pg.yml
More file actions
90 lines (86 loc) · 5.8 KB
/
0110-pg.yml
File metadata and controls
90 lines (86 loc) · 5.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#==============================================================#
# 0110 pg
#==============================================================#
pg_primary_only:
name: pg
desc: PostgreSQL basic information (on primary)
query: |-
SELECT
extract(EPOCH FROM CURRENT_TIMESTAMP) AS timestamp,
extract(EPOCH FROM now() - pg_postmaster_start_time()) AS uptime,
extract(EPOCH FROM pg_postmaster_start_time()) AS boot_time,
pg_current_wal_lsn() - '0/0' AS lsn,
pg_current_wal_insert_lsn() - '0/0' AS insert_lsn,
pg_current_wal_lsn() - '0/0' AS write_lsn,
pg_current_wal_flush_lsn() - '0/0' AS flush_lsn,
NULL::BIGINT AS receive_lsn,
NULL::BIGINT AS replay_lsn,
extract(EPOCH FROM pg_conf_load_time()) AS reload_time,
extract(EPOCH FROM now() - pg_conf_load_time()) AS conf_reload_time,
NULL::FLOAT AS last_replay_time,
0::FLOAT AS lag,
pg_is_in_recovery() AS is_in_recovery,
FALSE AS is_wal_replay_paused;
tags: [ cluster, primary ]
ttl: 1
min_version: 100000
fatal: true
skip: false
metrics:
- timestamp: { usage: GAUGE ,description: "current database timestamp in unix epoch" }
- uptime: { usage: GAUGE ,description: "seconds since postmaster start" }
- boot_time: { usage: GAUGE ,description: "postmaster boot timestamp in unix epoch" }
- lsn: { usage: COUNTER ,description: "log sequence number, current write location" }
- insert_lsn: { usage: COUNTER ,description: "primary only, location of current wal inserting" }
- write_lsn: { usage: COUNTER ,description: "primary only, location of current wal writing" }
- flush_lsn: { usage: COUNTER ,description: "primary only, location of current wal syncing" }
- receive_lsn: { usage: COUNTER ,description: "replica only, location of wal synced to disk" }
- replay_lsn: { usage: COUNTER ,description: "replica only, location of wal applied" }
- reload_time: { usage: GAUGE ,description: "time when configuration was last reloaded" }
- conf_reload_time: { usage: GAUGE ,description: "seconds since last configuration reload" }
- last_replay_time: { usage: GAUGE ,description: "time when last transaction been replayed" }
- lag: { usage: GAUGE ,description: "replica only, replication lag in seconds" }
- is_in_recovery: { usage: GAUGE ,description: "1 if in recovery mode" }
- is_wal_replay_paused: { usage: GAUGE ,description: "1 if wal play is paused" }
pg_replica_only:
name: pg
desc: PostgreSQL basic information (on replica)
query: |-
SELECT
extract(EPOCH FROM CURRENT_TIMESTAMP) AS timestamp,
extract(EPOCH FROM now() - pg_postmaster_start_time()) AS uptime,
extract(EPOCH FROM pg_postmaster_start_time()) AS boot_time,
pg_last_wal_replay_lsn() - '0/0' AS lsn,
NULL::BIGINT AS insert_lsn,
NULL::BIGINT AS write_lsn,
NULL::BIGINT AS flush_lsn,
pg_last_wal_receive_lsn() - '0/0' AS receive_lsn,
pg_last_wal_replay_lsn() - '0/0' AS replay_lsn,
extract(EPOCH FROM pg_conf_load_time()) AS reload_time,
extract(EPOCH FROM now() - pg_conf_load_time()) AS conf_reload_time,
extract(EPOCH FROM pg_last_xact_replay_timestamp()) AS last_replay_time,
CASE WHEN pg_last_wal_receive_lsn() = pg_last_wal_replay_lsn() THEN 0
ELSE EXTRACT(EPOCH FROM now() - pg_last_xact_replay_timestamp()) END AS lag,
pg_is_in_recovery() AS is_in_recovery,
pg_is_wal_replay_paused() AS is_wal_replay_paused;
tags: [ cluster, replica ]
ttl: 1
min_version: 100000
fatal: true
skip: false
metrics:
- timestamp: { usage: GAUGE ,description: "current database timestamp in unix epoch" }
- uptime: { usage: GAUGE ,description: "seconds since postmaster start" }
- boot_time: { usage: GAUGE ,description: "postmaster boot timestamp in unix epoch" }
- lsn: { usage: COUNTER ,description: "log sequence number, current write location" }
- insert_lsn: { usage: COUNTER ,description: "primary only, location of current wal inserting" }
- write_lsn: { usage: COUNTER ,description: "primary only, location of current wal writing" }
- flush_lsn: { usage: COUNTER ,description: "primary only, location of current wal syncing" }
- receive_lsn: { usage: COUNTER ,description: "replica only, location of wal synced to disk" }
- replay_lsn: { usage: COUNTER ,description: "replica only, location of wal applied" }
- reload_time: { usage: GAUGE ,description: "time when configuration was last reloaded" }
- conf_reload_time: { usage: GAUGE ,description: "seconds since last configuration reload" }
- last_replay_time: { usage: GAUGE ,description: "time when last transaction been replayed" }
- lag: { usage: GAUGE ,description: "replica only, replication lag in seconds" }
- is_in_recovery: { usage: GAUGE ,description: "1 if in recovery mode" }
- is_wal_replay_paused: { usage: GAUGE ,description: "1 if wal play is paused" }