-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy path110-pg.yml
274 lines (270 loc) · 9.5 KB
/
110-pg.yml
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
##
# SYNOPSIS
# pg.pg_primary_only_*
#
# DESCRIPTION
# PostgreSQL basic information (on primary)
#
# OPTIONS
# Tags [cluster, primary]
# TTL 1
# Priority 0
# Timeout 100ms
# Fatal true
# Version 100000 ~ higher
# Source 110-pg.yml
#
# METRICS
# timestamp (GAUGE)
# current database timestamp in unix epoch
# uptime (GAUGE)
# seconds since postmaster start
# boot_time (GAUGE)
# postmaster boot timestamp in unix epoch
# lsn (COUNTER)
# log sequence number, current write location
# insert_lsn (COUNTER)
# primary only, location of current wal inserting
# write_lsn (COUNTER)
# primary only, location of current wal writing
# flush_lsn (COUNTER)
# primary only, location of current wal syncing
# receive_lsn (COUNTER)
# replica only, location of wal synced to disk
# replay_lsn (COUNTER)
# replica only, location of wal applied
# conf_reload_time (GAUGE)
# seconds since last configuration reload
# last_replay_time (GAUGE)
# time when last transaction been replayed
# lag (GAUGE)
# replica only, replication lag in seconds
# is_in_recovery (GAUGE)
# 1 if in recovery mode
# is_wal_replay_paused (GAUGE)
# 1 if wal play is paused
# is_in_backup (GAUGE)
# 1 if backup is in progress
# backup_time (GAUGE)
# seconds since current backup start
#
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 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
# timeout: 0.1
min_version: 100000
# max_version: 0
fatal: true
skip: false
metrics:
- timestamp:
name: timestamp
description: current database timestamp in unix epoch
usage: GAUGE
- uptime:
name: uptime
description: seconds since postmaster start
usage: GAUGE
- boot_time:
name: boot_time
description: postmaster boot timestamp in unix epoch
usage: GAUGE
- lsn:
name: lsn
description: log sequence number, current write location
usage: COUNTER
- insert_lsn:
name: insert_lsn
description: primary only, location of current wal inserting
usage: COUNTER
- write_lsn:
name: write_lsn
description: primary only, location of current wal writing
usage: COUNTER
- flush_lsn:
name: flush_lsn
description: primary only, location of current wal syncing
usage: COUNTER
- receive_lsn:
name: receive_lsn
description: replica only, location of wal synced to disk
usage: COUNTER
- replay_lsn:
name: replay_lsn
description: replica only, location of wal applied
usage: COUNTER
- conf_reload_time:
name: conf_reload_time
description: seconds since last configuration reload
usage: GAUGE
- last_replay_time:
name: last_replay_time
description: time when last transaction been replayed
usage: GAUGE
- lag:
name: lag
description: replica only, replication lag in seconds
usage: GAUGE
- is_in_recovery:
name: is_in_recovery
description: 1 if in recovery mode
usage: GAUGE
- is_wal_replay_paused:
name: is_wal_replay_paused
description: 1 if wal play is paused
usage: GAUGE
##
# SYNOPSIS
# pg.pg_replica_only_*
#
# DESCRIPTION
# PostgreSQL basic information (on replica)
#
# OPTIONS
# Tags [cluster, replica]
# TTL 1
# Priority 0
# Timeout 100ms
# Fatal true
# Version 100000 ~ higher
# Source 110-pg.yml
#
# METRICS
# timestamp (GAUGE)
# database current timestamp
# uptime (GAUGE)
# seconds since postmaster start
# boot_time (GAUGE)
# unix timestamp when postmaster boot
# lsn (COUNTER)
# log sequence number, current write location
# insert_lsn (COUNTER)
# primary only, location of current wal inserting
# write_lsn (COUNTER)
# primary only, location of current wal writing
# flush_lsn (COUNTER)
# primary only, location of current wal syncing
# receive_lsn (COUNTER)
# replica only, location of wal synced to disk
# replay_lsn (COUNTER)
# replica only, location of wal applied
# conf_reload_time (GAUGE)
# seconds since last configuration reload
# last_replay_time (GAUGE)
# time when last transaction been replayed
# lag (GAUGE)
# replica only, replication lag in seconds
# is_in_recovery (GAUGE)
# 1 if in recovery mode
# is_wal_replay_paused (GAUGE)
# 1 if wal play paused
# is_in_backup (GAUGE)
# 1 if backup is in progress
# backup_time (GAUGE)
# seconds since current backup start
#
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 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
# timeout: 0.1
min_version: 100000
# max_version: 0
fatal: true
skip: false
metrics:
- timestamp:
name: timestamp
description: database current timestamp
usage: GAUGE
- uptime:
name: uptime
description: seconds since postmaster start
usage: GAUGE
- boot_time:
name: boot_time
description: unix timestamp when postmaster boot
usage: GAUGE
- lsn:
name: lsn
description: log sequence number, current write location
usage: COUNTER
- insert_lsn:
name: insert_lsn
description: primary only, location of current wal inserting
usage: COUNTER
- write_lsn:
name: write_lsn
description: primary only, location of current wal writing
usage: COUNTER
- flush_lsn:
name: flush_lsn
description: primary only, location of current wal syncing
usage: COUNTER
- receive_lsn:
name: receive_lsn
description: replica only, location of wal synced to disk
usage: COUNTER
- replay_lsn:
name: replay_lsn
description: replica only, location of wal applied
usage: COUNTER
- conf_reload_time:
name: conf_reload_time
description: seconds since last configuration reload
usage: GAUGE
- last_replay_time:
name: last_replay_time
description: time when last transaction been replayed
usage: GAUGE
- lag:
name: lag
description: replica only, replication lag in seconds
usage: GAUGE
- is_in_recovery:
name: is_in_recovery
description: 1 if in recovery mode
usage: GAUGE
- is_wal_replay_paused:
name: is_wal_replay_paused
description: 1 if wal play paused
usage: GAUGE