fix master database behavior
This commit is contained in:
143
queries.yaml
143
queries.yaml
@@ -1,5 +1,6 @@
|
||||
pg_replication:
|
||||
query: "SELECT EXTRACT(EPOCH FROM (now() - pg_last_xact_replay_timestamp())) as lag"
|
||||
master: true
|
||||
metrics:
|
||||
- lag:
|
||||
usage: "GAUGE"
|
||||
@@ -7,14 +8,18 @@ pg_replication:
|
||||
|
||||
pg_postmaster:
|
||||
query: "SELECT pg_postmaster_start_time as start_time_seconds from pg_postmaster_start_time()"
|
||||
master: true
|
||||
metrics:
|
||||
- start_time_seconds:
|
||||
usage: "GAUGE"
|
||||
description: "Time at which postmaster started"
|
||||
|
||||
pg_stat_user_tables:
|
||||
query: "SELECT schemaname, relname, seq_scan, seq_tup_read, idx_scan, idx_tup_fetch, n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze, COALESCE(last_vacuum, '1970-01-01Z'), COALESCE(last_vacuum, '1970-01-01Z') as last_vacuum, COALESCE(last_autovacuum, '1970-01-01Z') as last_autovacuum, COALESCE(last_analyze, '1970-01-01Z') as last_analyze, COALESCE(last_autoanalyze, '1970-01-01Z') as last_autoanalyze, vacuum_count, autovacuum_count, analyze_count, autoanalyze_count FROM pg_stat_user_tables"
|
||||
query: "SELECT current_database() datname, schemaname, relname, seq_scan, seq_tup_read, idx_scan, idx_tup_fetch, n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze, COALESCE(last_vacuum, '1970-01-01Z'), COALESCE(last_vacuum, '1970-01-01Z') as last_vacuum, COALESCE(last_autovacuum, '1970-01-01Z') as last_autovacuum, COALESCE(last_analyze, '1970-01-01Z') as last_analyze, COALESCE(last_autoanalyze, '1970-01-01Z') as last_autoanalyze, vacuum_count, autovacuum_count, analyze_count, autoanalyze_count FROM pg_stat_user_tables"
|
||||
metrics:
|
||||
- datname:
|
||||
usage: "LABEL"
|
||||
description: "Name of current database"
|
||||
- schemaname:
|
||||
usage: "LABEL"
|
||||
description: "Name of the schema that this table is in"
|
||||
@@ -80,8 +85,11 @@ pg_stat_user_tables:
|
||||
description: "Number of times this table has been analyzed by the autovacuum daemon"
|
||||
|
||||
pg_statio_user_tables:
|
||||
query: "SELECT schemaname, relname, heap_blks_read, heap_blks_hit, idx_blks_read, idx_blks_hit, toast_blks_read, toast_blks_hit, tidx_blks_read, tidx_blks_hit FROM pg_statio_user_tables"
|
||||
query: "SELECT current_database() datname, schemaname, relname, heap_blks_read, heap_blks_hit, idx_blks_read, idx_blks_hit, toast_blks_read, toast_blks_hit, tidx_blks_read, tidx_blks_hit FROM pg_statio_user_tables"
|
||||
metrics:
|
||||
- datname:
|
||||
usage: "LABEL"
|
||||
description: "Name of current database"
|
||||
- schemaname:
|
||||
usage: "LABEL"
|
||||
description: "Name of the schema that this table is in"
|
||||
@@ -115,6 +123,7 @@ pg_statio_user_tables:
|
||||
|
||||
pg_database:
|
||||
query: "SELECT pg_database.datname, pg_database_size(pg_database.datname) as size FROM pg_database"
|
||||
master: true
|
||||
cache_seconds: 30
|
||||
metrics:
|
||||
- datname:
|
||||
@@ -124,67 +133,73 @@ pg_database:
|
||||
usage: "GAUGE"
|
||||
description: "Disk space used by the database"
|
||||
|
||||
|
||||
pg_stat_statements:
|
||||
query: "SELECT query, calls, total_time / 1000 as total_time_seconds, min_time / 1000 as min_time_seconds, max_time / 1000 as max_time_seconds, mean_time / 1000 as mean_time_seconds, stddev_time / 1000 as stddev_time_seconds, rows, shared_blks_hit, shared_blks_read, shared_blks_dirtied, shared_blks_written, local_blks_hit, local_blks_read, local_blks_dirtied, local_blks_written, temp_blks_read, temp_blks_written, blk_read_time / 1000 as blk_read_time_seconds, blk_write_time / 1000 as blk_write_time_seconds FROM pg_stat_statements"
|
||||
query: "SELECT t2.rolname, t3.datname, queryid, calls, total_time / 1000 as total_time_seconds, min_time / 1000 as min_time_seconds, max_time / 1000 as max_time_seconds, mean_time / 1000 as mean_time_seconds, stddev_time / 1000 as stddev_time_seconds, rows, shared_blks_hit, shared_blks_read, shared_blks_dirtied, shared_blks_written, local_blks_hit, local_blks_read, local_blks_dirtied, local_blks_written, temp_blks_read, temp_blks_written, blk_read_time / 1000 as blk_read_time_seconds, blk_write_time / 1000 as blk_write_time_seconds FROM pg_stat_statements t1 join pg_roles t2 on (t1.userid=t2.oid) join pg_database t3 on (t1.dbid=t3.oid)"
|
||||
master: true
|
||||
metrics:
|
||||
- query:
|
||||
usage: "LABEL"
|
||||
description: "Query class"
|
||||
- calls:
|
||||
usage: "COUNTER"
|
||||
description: "Number of times executed"
|
||||
- total_time_seconds:
|
||||
usage: "COUNTER"
|
||||
description: "Total time spent in the statement, in milliseconds"
|
||||
- min_time_seconds:
|
||||
usage: "GAUGE"
|
||||
description: "Minimum time spent in the statement, in milliseconds"
|
||||
- max_time_seconds:
|
||||
usage: "GAUGE"
|
||||
description: "Maximum time spent in the statement, in milliseconds"
|
||||
- mean_time_seconds:
|
||||
usage: "GAUGE"
|
||||
description: "Mean time spent in the statement, in milliseconds"
|
||||
- stddev_time_seconds:
|
||||
usage: "GAUGE"
|
||||
description: "Population standard deviation of time spent in the statement, in milliseconds"
|
||||
- rows:
|
||||
usage: "COUNTER"
|
||||
description: "Total number of rows retrieved or affected by the statement"
|
||||
- shared_blks_hit:
|
||||
usage: "COUNTER"
|
||||
description: "Total number of shared block cache hits by the statement"
|
||||
- shared_blks_read:
|
||||
usage: "COUNTER"
|
||||
description: "Total number of shared blocks read by the statement"
|
||||
- shared_blks_dirtied:
|
||||
usage: "COUNTER"
|
||||
description: "Total number of shared blocks dirtied by the statement"
|
||||
- shared_blks_written:
|
||||
usage: "COUNTER"
|
||||
description: "Total number of shared blocks written by the statement"
|
||||
- local_blks_hit:
|
||||
usage: "COUNTER"
|
||||
description: "Total number of local block cache hits by the statement"
|
||||
- local_blks_read:
|
||||
usage: "COUNTER"
|
||||
description: "Total number of local blocks read by the statement"
|
||||
- local_blks_dirtied:
|
||||
usage: "COUNTER"
|
||||
description: "Total number of local blocks dirtied by the statement"
|
||||
- local_blks_written:
|
||||
usage: "COUNTER"
|
||||
description: "Total number of local blocks written by the statement"
|
||||
- temp_blks_read:
|
||||
usage: "COUNTER"
|
||||
description: "Total number of temp blocks read by the statement"
|
||||
- temp_blks_written:
|
||||
usage: "COUNTER"
|
||||
description: "Total number of temp blocks written by the statement"
|
||||
- blk_read_time_seconds:
|
||||
usage: "COUNTER"
|
||||
description: "Total time the statement spent reading blocks, in milliseconds (if track_io_timing is enabled, otherwise zero)"
|
||||
- blk_write_time_seconds:
|
||||
usage: "COUNTER"
|
||||
description: "Total time the statement spent writing blocks, in milliseconds (if track_io_timing is enabled, otherwise zero)"
|
||||
- rolname:
|
||||
usage: "LABEL"
|
||||
description: "Name of user"
|
||||
- datname:
|
||||
usage: "LABEL"
|
||||
description: "Name of database"
|
||||
- queryid:
|
||||
usage: "LABEL"
|
||||
description: "Query ID"
|
||||
- calls:
|
||||
usage: "COUNTER"
|
||||
description: "Number of times executed"
|
||||
- total_time_seconds:
|
||||
usage: "COUNTER"
|
||||
description: "Total time spent in the statement, in milliseconds"
|
||||
- min_time_seconds:
|
||||
usage: "GAUGE"
|
||||
description: "Minimum time spent in the statement, in milliseconds"
|
||||
- max_time_seconds:
|
||||
usage: "GAUGE"
|
||||
description: "Maximum time spent in the statement, in milliseconds"
|
||||
- mean_time_seconds:
|
||||
usage: "GAUGE"
|
||||
description: "Mean time spent in the statement, in milliseconds"
|
||||
- stddev_time_seconds:
|
||||
usage: "GAUGE"
|
||||
description: "Population standard deviation of time spent in the statement, in milliseconds"
|
||||
- rows:
|
||||
usage: "COUNTER"
|
||||
description: "Total number of rows retrieved or affected by the statement"
|
||||
- shared_blks_hit:
|
||||
usage: "COUNTER"
|
||||
description: "Total number of shared block cache hits by the statement"
|
||||
- shared_blks_read:
|
||||
usage: "COUNTER"
|
||||
description: "Total number of shared blocks read by the statement"
|
||||
- shared_blks_dirtied:
|
||||
usage: "COUNTER"
|
||||
description: "Total number of shared blocks dirtied by the statement"
|
||||
- shared_blks_written:
|
||||
usage: "COUNTER"
|
||||
description: "Total number of shared blocks written by the statement"
|
||||
- local_blks_hit:
|
||||
usage: "COUNTER"
|
||||
description: "Total number of local block cache hits by the statement"
|
||||
- local_blks_read:
|
||||
usage: "COUNTER"
|
||||
description: "Total number of local blocks read by the statement"
|
||||
- local_blks_dirtied:
|
||||
usage: "COUNTER"
|
||||
description: "Total number of local blocks dirtied by the statement"
|
||||
- local_blks_written:
|
||||
usage: "COUNTER"
|
||||
description: "Total number of local blocks written by the statement"
|
||||
- temp_blks_read:
|
||||
usage: "COUNTER"
|
||||
description: "Total number of temp blocks read by the statement"
|
||||
- temp_blks_written:
|
||||
usage: "COUNTER"
|
||||
description: "Total number of temp blocks written by the statement"
|
||||
- blk_read_time_seconds:
|
||||
usage: "COUNTER"
|
||||
description: "Total time the statement spent reading blocks, in milliseconds (if track_io_timing is enabled, otherwise zero)"
|
||||
- blk_write_time_seconds:
|
||||
usage: "COUNTER"
|
||||
description: "Total time the statement spent writing blocks, in milliseconds (if track_io_timing is enabled, otherwise zero)"
|
||||
|
||||
Reference in New Issue
Block a user