Skip to content

Commit

Permalink
[pgexporter#78] PostgreSQL V12 metrics examples
Browse files Browse the repository at this point in the history
  • Loading branch information
resyfer committed Jul 1, 2023
1 parent f27209d commit d7e2398
Showing 1 changed file with 181 additions and 0 deletions.
181 changes: 181 additions & 0 deletions contrib/yaml/postgresql-12.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
# This is the default minimum version for queries, unless specified otherwise
version: 12
metrics:

# GSS Authenticated DB Connections
- queries:
- query: SELECT COUNT(*)
FROM pg_stat_gssapi
JOIN pg_stat_activity
ON pg_stat_gssapi.pid = pg_stat_activity.pid
WHERE gss_authenticated = 't' AND datname IS NOT NULL;
columns:
- type: gauge
description: Number of GSSAPI authenticated DB connections.
tag: pg_gss_auth
collector: gssapi

# Encrypted DB Connections
- queries:
- query: SELECT COUNT(*)
FROM pg_stat_gssapi
JOIN pg_stat_activity
ON pg_stat_gssapi.pid = pg_stat_activity.pid
WHERE encrypted = 't' AND datname IS NOT NULL;
columns:
- type: gauge
description: Number of encrypted DB connections.
tag: pg_encrypted_conn
collector: encryted_conns

# DB Stats
- queries:
- query: SELECT
datname,
blk_read_time,
blk_write_time,
blks_hit,
blks_read,
deadlocks,
temp_files,
temp_bytes,
tup_returned,
tup_fetched,
tup_inserted,
tup_updated,
tup_deleted,
xact_commit,
xact_rollback,
conflicts,
numbackends
FROM pg_stat_database
WHERE datname IS NOT NULL
ORDER BY datname;
columns:
- name: database
type: label
- name: blk_read_time
type: counter
description: pg_stat_database_blk_read_time
- name: blk_write_time
type: counter
description: pg_stat_database_blk_write_time
- name: blks_hit
type: counter
description: pg_stat_database_blks_hit
- name: blks_read
type: counter
description: pg_stat_database_blks_read
- name: deadlocks
type: counter
description: pg_stat_database_deadlocks
- name: temp_files
type: gauge
description: pg_stat_database_temp_files
- name: temp_bytes
type: gauge
description: pg_stat_database_temp_bytes
- name: tup_returned
type: counter
description: pg_stat_database_tup_returned
- name: tup_fetched
type: counter
description: pg_stat_database_tup_fetched
- name: tup_inserted
type: counter
description: pg_stat_database_tup_inserted
- name: tup_updated
type: counter
description: pg_stat_database_tup_updated
- name: tup_deleted
type: counter
description: pg_stat_database_tup_deleted
- name: xact_commit
type: counter
description: pg_stat_database_xact_commit
- name: xact_rollback
type: counter
description: pg_stat_database_xact_rollback
- name: conflicts
type: counter
description: pg_stat_database_conflicts
- name: numbackends
type: gauge
description: pg_stat_database_numbackends
version: 10

- query: SELECT
datname,
blk_read_time,
blk_write_time,
blks_hit,
blks_read,
checksum_failures,
deadlocks,
temp_files,
temp_bytes,
tup_returned,
tup_fetched,
tup_inserted,
tup_updated,
tup_deleted,
xact_commit,
xact_rollback,
conflicts,
numbackends,
checksum_failures
FROM pg_stat_database WHERE datname IS NOT NULL ORDER BY datname;
columns:
- name: database
type: label
- name: blk_read_time
type: counter
description: pg_stat_database_blk_read_time
- name: blk_write_time
type: counter
description: pg_stat_database_blk_write_time
- name: blks_hit
type: counter
description: pg_stat_database_blks_hit
- name: blks_read
type: counter
description: pg_stat_database_blks_read
- name: deadlocks
type: counter
description: pg_stat_database_deadlocks
- name: temp_files
type: gauge
description: pg_stat_database_temp_files
- name: temp_bytes
type: gauge
description: pg_stat_database_temp_bytes
- name: tup_returned
type: counter
description: pg_stat_database_tup_returned
- name: tup_fetched
type: counter
description: pg_stat_database_tup_fetched
- name: tup_inserted
type: counter
description: pg_stat_database_tup_inserted
- name: tup_updated
type: counter
description: pg_stat_database_tup_updated
- name: tup_deleted
type: counter
description: pg_stat_database_tup_deleted
- name: xact_commit
type: counter
description: pg_stat_database_xact_commit
- name: xact_rollback
type: counter
description: pg_stat_database_xact_rollback
- name: conflicts
type: counter
description: pg_stat_database_conflicts
- name: numbackends
type: gauge
description: pg_stat_database_numbackends
tag: pg_stat_database
collector: stat_db
sort: data

0 comments on commit d7e2398

Please sign in to comment.