-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy path0250-pg_recv.yml
More file actions
96 lines (90 loc) · 8 KB
/
0250-pg_recv.yml
File metadata and controls
96 lines (90 loc) · 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
89
90
91
92
93
94
95
#==============================================================#
# 0250 pg_recv
#==============================================================#
pg_recv_13:
name: pg_recv
desc: PostgreSQL walreceiver metrics 13+
query: |-
SELECT
coalesce(sender_host, (regexp_match(conninfo, '.*host=(\S+).*'))[1]) AS sender_host, coalesce(sender_port::TEXT, (regexp_match(conninfo, '.*port=(\S+).*'))[1]) AS sender_port, coalesce(slot_name, 'NULL') AS slot_name,
pid, CASE status WHEN 'streaming' THEN 0 WHEN 'startup' THEN 1 WHEN 'catchup' THEN 2 WHEN 'backup' THEN 3 WHEN 'stopping' THEN 4 ELSE -1 END AS state,
receive_start_lsn - '0/0' AS init_lsn,receive_start_tli AS init_tli,
flushed_lsn - '0/0' AS flush_lsn,written_lsn - '0/0' AS write_lsn, received_tli AS flush_tli, latest_end_lsn - '0/0' AS reported_lsn,
last_msg_send_time AS msg_send_time,last_msg_receipt_time AS msg_recv_time,latest_end_time AS reported_time,now() AS time FROM pg_stat_wal_receiver;
ttl: 10
min_version: 130000
tags: [ cluster, replica ]
metrics:
- sender_host: { usage: LABEL ,description: "Host of the PostgreSQL instance this WAL receiver is connected to" }
- sender_port: { usage: LABEL ,description: "Port number of the PostgreSQL instance this WAL receiver is connected to." }
- slot_name: { usage: LABEL ,description: "Replication slot name used by this WAL receiver" }
- pid: { usage: GAUGE ,description: "Process ID of the WAL receiver process" }
- state: { usage: GAUGE ,description: "Encoded activity status of the WAL receiver process 0-4 for streaming|startup|catchup|backup|stopping" }
- init_lsn: { usage: COUNTER ,description: "First write-ahead log location used when WAL receiver is started" }
- init_tli: { usage: COUNTER ,description: "First timeline number used when WAL receiver is started" }
- flush_lsn: { usage: COUNTER ,description: "Last write-ahead log location already received and flushed to disk" }
- write_lsn: { usage: COUNTER ,description: "Last write-ahead log location already received and written to disk, but not flushed." }
- flush_tli: { usage: COUNTER ,description: "Timeline number of last write-ahead log location received and flushed to disk" }
- reported_lsn: { usage: COUNTER ,description: "Last write-ahead log location reported to origin WAL sender" }
- msg_send_time: { usage: GAUGE ,description: "Send time of last message received from origin WAL sender" }
- msg_recv_time: { usage: GAUGE ,description: "Receipt time of last message received from origin WAL sender" }
- reported_time: { usage: GAUGE ,description: "Time of last write-ahead log location reported to origin WAL sender" }
- time: { usage: GAUGE ,description: "Time of current snapshot" }
pg_recv_11:
name: pg_recv
desc: PostgreSQL walreceiver metrics (11-12)
query: |-
SELECT
coalesce(sender_host, (regexp_match(conninfo, '.*host=(\S+).*'))[1]) AS sender_host, coalesce(sender_port::TEXT, (regexp_match(conninfo, '.*port=(\S+).*'))[1]) AS sender_port, coalesce(slot_name, 'NULL') AS slot_name,
pid, CASE status WHEN 'streaming' THEN 0 WHEN 'startup' THEN 1 WHEN 'catchup' THEN 2 WHEN 'backup' THEN 3 WHEN 'stopping' THEN 4 ELSE -1 END AS state,
receive_start_lsn - '0/0' AS init_lsn,receive_start_tli AS init_tli,
received_lsn - '0/0' AS flush_lsn, received_tli AS flush_tli, latest_end_lsn - '0/0' AS reported_lsn,
last_msg_send_time AS msg_send_time,last_msg_receipt_time AS msg_recv_time,latest_end_time AS reported_time,now() AS time FROM pg_stat_wal_receiver;
ttl: 10
tags: [ cluster, replica ]
min_version: 110000
max_version: 130000
metrics:
- sender_host: { usage: LABEL ,description: "Host of the PostgreSQL instance this WAL receiver is connected to" }
- sender_port: { usage: LABEL ,description: "Port number of the PostgreSQL instance this WAL receiver is connected to." }
- slot_name: { usage: LABEL ,description: "Replication slot name used by this WAL receiver" }
- pid: { usage: GAUGE ,description: "Process ID of the WAL receiver process" }
- state: { usage: GAUGE ,description: "Encoded activity status of the WAL receiver process 0-4 for streaming|startup|catchup|backup|stopping" }
- init_lsn: { usage: COUNTER ,description: "First write-ahead log location used when WAL receiver is started" }
- init_tli: { usage: COUNTER ,description: "First timeline number used when WAL receiver is started" }
- flush_lsn: { usage: COUNTER ,description: "Last write-ahead log location already received and flushed to disk" }
- flush_tli: { usage: COUNTER ,description: "Timeline number of last write-ahead log location received and flushed to disk" }
- reported_lsn: { usage: COUNTER ,description: "Last write-ahead log location reported to origin WAL sender" }
- msg_send_time: { usage: GAUGE ,description: "Send time of last message received from origin WAL sender" }
- msg_recv_time: { usage: GAUGE ,description: "Receipt time of last message received from origin WAL sender" }
- reported_time: { usage: GAUGE ,description: "Time of last write-ahead log location reported to origin WAL sender" }
- time: { usage: GAUGE ,description: "Time of current snapshot" }
pg_recv_10:
name: pg_recv
desc: PostgreSQL walreceiver metrics (10)
query: |-
SELECT
(regexp_match(conninfo, '.*host=(\S+).*'))[1] AS sender_host, (regexp_match(conninfo, '.*port=(\S+).*'))[1] AS sender_port, coalesce(slot_name, 'NULL') AS slot_name,
pid, CASE status WHEN 'streaming' THEN 0 WHEN 'startup' THEN 1 WHEN 'catchup' THEN 2 WHEN 'backup' THEN 3 WHEN 'stopping' THEN 4 ELSE -1 END AS state,
receive_start_lsn - '0/0' AS init_lsn,receive_start_tli AS init_tli,
received_lsn - '0/0' AS flush_lsn, received_tli AS flush_tli, latest_end_lsn - '0/0' AS reported_lsn,
last_msg_send_time AS msg_send_time,last_msg_receipt_time AS msg_recv_time,latest_end_time AS reported_time,now() AS time FROM pg_stat_wal_receiver;
ttl: 10
tags: [ cluster, replica ]
min_version: 100000
max_version: 110000
metrics:
- sender_host: { usage: LABEL ,description: "Host of the PostgreSQL instance this WAL receiver is connected to" }
- sender_port: { usage: LABEL ,description: "Port number of the PostgreSQL instance this WAL receiver is connected to." }
- slot_name: { usage: LABEL ,description: "Replication slot name used by this WAL receiver" }
- pid: { usage: GAUGE ,description: "Process ID of the WAL receiver process" }
- state: { usage: GAUGE ,description: "Encoded activity status of the WAL receiver process 0-4 for streaming|startup|catchup|backup|stopping" }
- init_lsn: { usage: COUNTER ,description: "First write-ahead log location used when WAL receiver is started" }
- init_tli: { usage: COUNTER ,description: "First timeline number used when WAL receiver is started" }
- flush_lsn: { usage: COUNTER ,description: "Last write-ahead log location already received and flushed to disk" }
- flush_tli: { usage: COUNTER ,description: "Timeline number of last write-ahead log location received and flushed to disk" }
- reported_lsn: { usage: COUNTER ,description: "Last write-ahead log location reported to origin WAL sender" }
- msg_send_time: { usage: GAUGE ,description: "Send time of last message received from origin WAL sender" }
- msg_recv_time: { usage: GAUGE ,description: "Receipt time of last message received from origin WAL sender" }
- reported_time: { usage: GAUGE ,description: "Time of last write-ahead log location reported to origin WAL sender" }
- time: { usage: GAUGE ,description: "Time of current snapshot" }