-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy path610-pg_db.yml
451 lines (438 loc) · 22.7 KB
/
610-pg_db.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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
##
# SYNOPSIS
# pg_db.pg_db_12_13_*
#
# DESCRIPTION
# PostgreSQL database stats from pg_stat_database v12 v13 (with 2 new checksum metrics)
#
# OPTIONS
# Tags [cluster]
# TTL 10
# Priority 0
# Timeout 100ms
# Fatal false
# Version 120000 ~ 140000
# Source 610-pg_db.yml
#
# METRICS
# datname (LABEL)
# Name of the database
# datid (GAUGE)
# OID of the database
# age (GAUGE)
# Age of database calculated from datfrozenxid
# is_template (GAUGE)
# If true(1), then this database can be cloned by any user with CREATEDB privileges
# allow_conn (GAUGE)
# If false(0) then no one can connect to this database.
# conn_limit (GAUGE)
# Sets maximum number of concurrent connections that can be made to this database. -1 means no limit.
# frozen_xid (GAUGE)
# All transaction IDs before this one have been frozened
# numbackends (GAUGE)
# Number of backends currently connected to this database
# xact_commit (COUNTER)
# Number of transactions in this database that have been committed
# xact_rollback (COUNTER)
# Number of transactions in this database that have been rolled back
# xact_total (COUNTER)
# Number of transactions in this database
# blks_read (COUNTER)
# Number of disk blocks read in this database
# blks_hit (COUNTER)
# Number of times disk blocks were found already in the buffer cache
# blks_access (COUNTER)
# Number of times disk blocks that accessed read+hit
# tup_returned (COUNTER)
# Number of rows returned by queries in this database
# tup_fetched (COUNTER)
# Number of rows fetched by queries in this database
# tup_inserted (COUNTER)
# Number of rows inserted by queries in this database
# tup_updated (COUNTER)
# Number of rows updated by queries in this database
# tup_deleted (COUNTER)
# Number of rows deleted by queries in this database
# tup_modified (COUNTER)
# Number of rows modified by queries in this database
# conflicts (COUNTER)
# Number of queries canceled due to conflicts with recovery in this database
# temp_files (COUNTER)
# Number of temporary files created by queries in this database
# temp_bytes (COUNTER)
# Total amount of data written to temporary files by queries in this database.
# deadlocks (COUNTER)
# Number of deadlocks detected in this database
# cks_fails (COUNTER)
# Number of data page checksum failures detected in this database, -1 for not enabled
# cks_fail_time (GAUGE)
# Time at which the last data page checksum failure was detected in this database
# blk_read_time (COUNTER)
# Time spent reading data file blocks by backends in this database, in seconds
# blk_write_time (COUNTER)
# Time spent writing data file blocks by backends in this database, in seconds
# reset_time (COUNTER)
# Time at which database statistics were last reset
#
pg_db_14:
name: pg_db
desc: PostgreSQL database stats from pg_stat_database v14 (with 7 new time & session metrics)
query: |
SELECT d.datname, datid,age(datfrozenxid) AS age, datistemplate AS is_template, datallowconn AS allow_conn, datconnlimit AS conn_limit, datfrozenxid::TEXT::BIGINT as frozen_xid,
numbackends,xact_commit,xact_rollback,xact_rollback + xact_commit AS xact_total,blks_read,blks_hit,blks_read + blks_hit AS blks_access,tup_returned,tup_fetched,tup_inserted,tup_updated,tup_deleted,tup_inserted + tup_updated + tup_deleted AS tup_modified,
conflicts,temp_files,temp_bytes,deadlocks,coalesce(checksum_failures, -1) AS cks_fails, checksum_last_failure AS cks_fail_time,blk_read_time,blk_write_time,
session_time,active_time,idle_in_transaction_time AS ixact_time,sessions,sessions_abandoned,sessions_fatal,sessions_killed,extract(EPOCH FROM stats_reset) AS reset_time
FROM pg_database d JOIN pg_stat_database sd ON d.oid = sd.datid;
ttl: 10
min_version: 140000
tags:
- cluster
metrics:
- datname:
usage: LABEL
description: Name of the database
- datid:
usage: GAUGE
description: OID of the database
- age:
usage: GAUGE
description: Age of database calculated from datfrozenxid
- is_template:
usage: GAUGE
description: If true(1), then this database can be cloned by any user with CREATEDB privileges
# If true, then this database can be cloned by any user with CREATEDB privileges; if false, then only superusers or the owner of the database can clone it.
- allow_conn:
usage: GAUGE
description: If false(0) then no one can connect to this database.
# This is used to protect the template0 database from being altered.
- conn_limit:
usage: GAUGE
description: Sets maximum number of concurrent connections that can be made to this database. -1 means no limit.
- frozen_xid:
usage: GAUGE
description: All transaction IDs before this one have been frozened
- numbackends:
usage: GAUGE
description: Number of backends currently connected to this database
# Number of backends currently connected to this database, or NULL for shared objects. This is the only column in this view that returns a value reflecting current state; all other columns return the accumulated values since the last reset.
- xact_commit:
usage: COUNTER
description: Number of transactions in this database that have been committed
# Number of transactions in this database that have been committed
- xact_rollback:
usage: COUNTER
description: Number of transactions in this database that have been rolled back
- xact_total:
usage: COUNTER
description: Number of transactions in this database
- blks_read:
usage: COUNTER
description: Number of disk blocks read in this database
- blks_hit:
usage: COUNTER
description: Number of times disk blocks were found already in the buffer cache
# Number of times disk blocks were found already in the buffer cache, so that a read was not necessary (this only includes hits in the PostgreSQL buffer cache, not the operating system's file system cache)
- blks_access:
usage: COUNTER
description: Number of times disk blocks that accessed read+hit
- tup_returned:
usage: COUNTER
description: Number of rows returned by queries in this database
- tup_fetched:
usage: COUNTER
description: Number of rows fetched by queries in this database
- tup_inserted:
usage: COUNTER
description: Number of rows inserted by queries in this database
- tup_updated:
usage: COUNTER
description: Number of rows updated by queries in this database
- tup_deleted:
usage: COUNTER
description: Number of rows deleted by queries in this database
- tup_modified:
usage: COUNTER
description: Number of rows modified by queries in this database
- conflicts:
usage: COUNTER
description: Number of queries canceled due to conflicts with recovery in this database
# (Conflicts occur only on standby servers; see pg_stat_database_conflicts for details.)
- temp_files:
usage: COUNTER
description: Number of temporary files created by queries in this database
# Number of temporary files created by queries in this database. All temporary files are counted, regardless of why the temporary file was created (e.g., sorting or hashing), and regardless of the log_temp_files setting.
- temp_bytes:
usage: COUNTER
description: Total amount of data written to temporary files by queries in this database.
# Total amount of data written to temporary files by queries in this database. All temporary files are counted, regardless of why the temporary file was created, and regardless of the log_temp_files setting.
- deadlocks:
usage: COUNTER
description: Number of deadlocks detected in this database
- cks_fails:
usage: COUNTER
description: Number of data page checksum failures detected in this database, -1 for not enabled
# Number of data page checksum failures detected in this database (or on a shared object), or NULL if data checksums are not enabled.
- cks_fail_time:
usage: GAUGE
description: Time at which the last data page checksum failure was detected in this database
# Time at which the last data page checksum failure was detected in this database (or on a shared object), or NULL if data checksums are not enabled.
- blk_read_time:
usage: COUNTER
scale: 1e-3
description: Time spent reading data file blocks by backends in this database, in seconds
# Time spent reading data file blocks by backends in this database, in milliseconds (if track_io_timing is enabled, otherwise zero)
- blk_write_time:
usage: COUNTER
scale: 1e-3
description: Time spent writing data file blocks by backends in this database, in seconds
# Time spent writing data file blocks by backends in this database, in milliseconds (if track_io_timing is enabled, otherwise zero)
- session_time:
usage: COUNTER
scale: 1e-3
description: Time spent by database sessions in this database, in seconds
# Time spent by database sessions in this database, in milliseconds (note that statistics are only updated when the state of a session changes, so if sessions have been idle for a long time, this idle time won't be included)
- active_time:
usage: COUNTER
scale: 1e-3
description: Time spent executing SQL statements in this database, in seconds
# Time spent executing SQL statements in this database, in milliseconds (this corresponds to the states active and fastpath function call in pg_stat_activity)
- ixact_time:
usage: COUNTER
scale: 1e-3
description: Time spent idling while in a transaction in this database, in seconds
- sessions:
usage: COUNTER
description: Total number of sessions established to this database
- sessions_abandoned:
usage: COUNTER
description: Number of database sessions to this database that were terminated because connection to the client was lost
- sessions_fatal:
usage: COUNTER
description: Number of database sessions to this database that were terminated by fatal errors
- sessions_killed:
usage: COUNTER
description: Number of database sessions to this database that were terminated by operator intervention
- reset_time:
usage: COUNTER
description: Time at which database statistics were last reset
pg_db_12_13:
name: pg_db
desc: PostgreSQL database stats from pg_stat_database v12 v13 (with 2 new checksum metrics)
query: |
SELECT d.datname, datid,age(datfrozenxid) AS age, datistemplate AS is_template, datallowconn AS allow_conn, datconnlimit AS conn_limit, datfrozenxid::TEXT::BIGINT as frozen_xid,
numbackends,xact_commit,xact_rollback,xact_rollback + xact_commit AS xact_total,blks_read,blks_hit,blks_read + blks_hit AS blks_access,tup_returned,tup_fetched,tup_inserted,tup_updated,tup_deleted,tup_inserted + tup_updated + tup_deleted AS tup_modified,
conflicts,temp_files,temp_bytes,deadlocks,coalesce(checksum_failures, -1) AS cks_fails, checksum_last_failure AS cks_fail_time,blk_read_time,blk_write_time,
extract(EPOCH FROM stats_reset) AS reset_time FROM pg_database d JOIN pg_stat_database sd ON d.oid = sd.datid;
ttl: 10
min_version: 120000
max_version: 140000
tags:
- cluster
metrics:
- datname:
usage: LABEL
description: Name of the database
- datid:
usage: GAUGE
description: OID of the database
- age:
usage: GAUGE
description: Age of database calculated from datfrozenxid
- is_template:
usage: GAUGE
description: If true(1), then this database can be cloned by any user with CREATEDB privileges
# If true, then this database can be cloned by any user with CREATEDB privileges; if false, then only superusers or the owner of the database can clone it.
- allow_conn:
usage: GAUGE
description: If false(0) then no one can connect to this database.
# This is used to protect the template0 database from being altered.
- conn_limit:
usage: GAUGE
description: Sets maximum number of concurrent connections that can be made to this database. -1 means no limit.
- frozen_xid:
usage: GAUGE
description: All transaction IDs before this one have been frozened
- numbackends:
usage: GAUGE
description: Number of backends currently connected to this database
# Number of backends currently connected to this database, or NULL for shared objects. This is the only column in this view that returns a value reflecting current state; all other columns return the accumulated values since the last reset.
- xact_commit:
usage: COUNTER
description: Number of transactions in this database that have been committed
# Number of transactions in this database that have been committed
- xact_rollback:
usage: COUNTER
description: Number of transactions in this database that have been rolled back
- xact_total:
usage: COUNTER
description: Number of transactions in this database
- blks_read:
usage: COUNTER
description: Number of disk blocks read in this database
- blks_hit:
usage: COUNTER
description: Number of times disk blocks were found already in the buffer cache
# Number of times disk blocks were found already in the buffer cache, so that a read was not necessary (this only includes hits in the PostgreSQL buffer cache, not the operating system's file system cache)
- blks_access:
usage: COUNTER
description: Number of times disk blocks that accessed read+hit
- tup_returned:
usage: COUNTER
description: Number of rows returned by queries in this database
- tup_fetched:
usage: COUNTER
description: Number of rows fetched by queries in this database
- tup_inserted:
usage: COUNTER
description: Number of rows inserted by queries in this database
- tup_updated:
usage: COUNTER
description: Number of rows updated by queries in this database
- tup_deleted:
usage: COUNTER
description: Number of rows deleted by queries in this database
- tup_modified:
usage: COUNTER
description: Number of rows modified by queries in this database
- conflicts:
usage: COUNTER
description: Number of queries canceled due to conflicts with recovery in this database
# (Conflicts occur only on standby servers; see pg_stat_database_conflicts for details.)
- temp_files:
usage: COUNTER
description: Number of temporary files created by queries in this database
# Number of temporary files created by queries in this database. All temporary files are counted, regardless of why the temporary file was created (e.g., sorting or hashing), and regardless of the log_temp_files setting.
- temp_bytes:
usage: COUNTER
description: Total amount of data written to temporary files by queries in this database.
# Total amount of data written to temporary files by queries in this database. All temporary files are counted, regardless of why the temporary file was created, and regardless of the log_temp_files setting.
- deadlocks:
usage: COUNTER
description: Number of deadlocks detected in this database
- cks_fails:
usage: COUNTER
description: Number of data page checksum failures detected in this database, -1 for not enabled
# Number of data page checksum failures detected in this database (or on a shared object), or NULL if data checksums are not enabled.
- cks_fail_time:
usage: GAUGE
description: Time at which the last data page checksum failure was detected in this database
# Time at which the last data page checksum failure was detected in this database (or on a shared object), or NULL if data checksums are not enabled.
- blk_read_time:
usage: COUNTER
scale: 1e-3
description: Time spent reading data file blocks by backends in this database, in seconds
# Time spent reading data file blocks by backends in this database, in milliseconds (if track_io_timing is enabled, otherwise zero)
- blk_write_time:
usage: COUNTER
scale: 1e-3
description: Time spent writing data file blocks by backends in this database, in seconds
# Time spent writing data file blocks by backends in this database, in milliseconds (if track_io_timing is enabled, otherwise zero)
- reset_time:
usage: COUNTER
description: Time at which database statistics were last reset
pg_db_10_11:
name: pg_db
desc: PostgreSQL database stats from pg_stat_database v10 v11 (actually since 9.2)
query: |
SELECT d.datname, datid,age(datfrozenxid) AS age, datistemplate AS is_template, datallowconn AS allow_conn, datconnlimit AS conn_limit, datfrozenxid::TEXT::BIGINT as frozen_xid,
numbackends,xact_commit,xact_rollback,xact_rollback + xact_commit AS xact_total, blks_read,blks_hit,blks_read + blks_hit AS blks_access,tup_returned,tup_fetched,tup_inserted,tup_updated,tup_deleted,tup_inserted + tup_updated + tup_deleted AS tup_modified,
conflicts,temp_files,temp_bytes,deadlocks,blk_read_time,blk_write_time, extract(EPOCH FROM stats_reset) AS reset_time FROM pg_database d JOIN pg_stat_database sd ON d.oid = sd.datid;
ttl: 10
min_version: 090200
max_version: 120000
tags:
- cluster
metrics:
- datname:
usage: LABEL
description: Name of the database
- datid:
usage: GAUGE
description: OID of the database
- age:
usage: GAUGE
description: Age of database calculated from datfrozenxid
- is_template:
usage: GAUGE
description: If true(1), then this database can be cloned by any user with CREATEDB privileges
# If true, then this database can be cloned by any user with CREATEDB privileges; if false, then only superusers or the owner of the database can clone it.
- allow_conn:
usage: GAUGE
description: If false(0) then no one can connect to this database.
# This is used to protect the template0 database from being altered.
- conn_limit:
usage: GAUGE
description: Sets maximum number of concurrent connections that can be made to this database. -1 means no limit.
- frozen_xid:
usage: GAUGE
description: All transaction IDs before this one have been frozened
- numbackends:
usage: GAUGE
description: Number of backends currently connected to this database
# Number of backends currently connected to this database, or NULL for shared objects. This is the only column in this view that returns a value reflecting current state; all other columns return the accumulated values since the last reset.
- xact_commit:
usage: COUNTER
description: Number of transactions in this database that have been committed
# Number of transactions in this database that have been committed
- xact_rollback:
usage: COUNTER
description: Number of transactions in this database that have been rolled back
- xact_total:
usage: COUNTER
description: Number of transactions in this database
- blks_read:
usage: COUNTER
description: Number of disk blocks read in this database
- blks_hit:
usage: COUNTER
description: Number of times disk blocks were found already in the buffer cache
# Number of times disk blocks were found already in the buffer cache, so that a read was not necessary (this only includes hits in the PostgreSQL buffer cache, not the operating system's file system cache)
- blks_access:
usage: COUNTER
description: Number of times disk blocks that accessed read+hit
- tup_returned:
usage: COUNTER
description: Number of rows returned by queries in this database
- tup_fetched:
usage: COUNTER
description: Number of rows fetched by queries in this database
- tup_inserted:
usage: COUNTER
description: Number of rows inserted by queries in this database
- tup_updated:
usage: COUNTER
description: Number of rows updated by queries in this database
- tup_deleted:
usage: COUNTER
description: Number of rows deleted by queries in this database
- tup_modified:
usage: COUNTER
description: Number of rows modified by queries in this database
- conflicts:
usage: COUNTER
description: Number of queries canceled due to conflicts with recovery in this database
# (Conflicts occur only on standby servers; see pg_stat_database_conflicts for details.)
- temp_files:
usage: COUNTER
description: Number of temporary files created by queries in this database
# Number of temporary files created by queries in this database. All temporary files are counted, regardless of why the temporary file was created (e.g., sorting or hashing), and regardless of the log_temp_files setting.
- temp_bytes:
usage: COUNTER
description: Total amount of data written to temporary files by queries in this database.
# Total amount of data written to temporary files by queries in this database. All temporary files are counted, regardless of why the temporary file was created, and regardless of the log_temp_files setting.
- deadlocks:
usage: COUNTER
description: Number of deadlocks detected in this database
- blk_read_time:
usage: COUNTER
scale: 1e-3
description: Time spent reading data file blocks by backends in this database, in seconds
# Time spent reading data file blocks by backends in this database, in milliseconds (if track_io_timing is enabled, otherwise zero)
- blk_write_time:
usage: COUNTER
scale: 1e-3
description: Time spent writing data file blocks by backends in this database, in seconds
# Time spent writing data file blocks by backends in this database, in milliseconds (if track_io_timing is enabled, otherwise zero)
- reset_time:
usage: COUNTER
description: Time at which database statistics were last reset