You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature (pgq): added views for special monitoring user.
Postgres role has to be created as:
CREATE ROLE monit LOGIN
NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE;
COMMENT ON ROLE monit IS 'Monitoring role';
ALTER ROLE monit SET search_path=public,monit;
Schema monit also have to be created and owned by role monit:
CREATE SCHEMA monit
AUTHORIZATION monit;
Views have to be defined as:
CREATE OR REPLACE VIEW monit.pgq_consumer AS
SELECT get_consumer_info.consumer_name AS name, date_part('epoch'::text, get_consumer_info.lag) AS lag
FROM pgq.get_consumer_info() get_consumer_info(queue_name, consumer_name, lag, last_seen, last_tick, current_batch, next_tick, pending_events);
"lag" : { COUNTER, "Consumer lag in seconds", nil },
96
+
},
87
97
"pg_stat_bgwriter" : map[string]ColumnMapping {
88
-
"checkpoints_timed" : { COUNTER, "Number of scheduled checkpoints that have been performed", nil },
89
-
"checkpoints_req" : { COUNTER, "Number of requested checkpoints that have been performed", nil },
90
-
"checkpoint_write_time" : { COUNTER, "Total amount of time that has been spent in the portion of checkpoint processing where files are written to disk, in milliseconds", nil },
91
-
"checkpoint_sync_time" : { COUNTER, "Total amount of time that has been spent in the portion of checkpoint processing where files are synchronized to disk, in milliseconds", nil },
92
-
"buffers_checkpoint" : { COUNTER, "Number of buffers written during checkpoints", nil },
93
-
"buffers_clean" : { COUNTER, "Number of buffers written by the background writer", nil },
94
-
"maxwritten_clean" : { COUNTER, "Number of times the background writer stopped a cleaning scan because it had written too many buffers", nil },
95
-
"buffers_backend" : { COUNTER, "Number of buffers written directly by a backend", nil },
96
-
"buffers_backend_fsync" : { COUNTER, "Number of times a backend had to execute its own fsync call (normally the background writer handles those even when the backend does its own write)", nil },
97
-
"buffers_alloc" : { COUNTER, "Number of buffers allocated", nil },
98
+
"checkpoints_timed" : { COUNTER, "Number of scheduled checkpoints that have been performed", nil },
99
+
"checkpoints_req" : { COUNTER, "Number of requested checkpoints that have been performed", nil },
100
+
"checkpoint_write_time" : { COUNTER, "Total amount of time that has been spent in the portion of checkpoint processing where files are written to disk, in milliseconds", nil },
101
+
"checkpoint_sync_time" : { COUNTER, "Total amount of time that has been spent in the portion of checkpoint processing where files are synchronized to disk, in milliseconds", nil },
102
+
"buffers_checkpoint" : { COUNTER, "Number of buffers written during checkpoints", nil },
103
+
"buffers_clean" : { COUNTER, "Number of buffers written by the background writer", nil },
104
+
"maxwritten_clean" : { COUNTER, "Number of times the background writer stopped a cleaning scan because it had written too many buffers", nil },
105
+
"buffers_backend" : { COUNTER, "Number of buffers written directly by a backend", nil },
106
+
"buffers_backend_fsync" : { COUNTER, "Number of times a backend had to execute its own fsync call (normally the background writer handles those even when the backend does its own write)", nil },
107
+
"buffers_alloc" : { COUNTER, "Number of buffers allocated", nil },
98
108
"stats_reset" : { COUNTER, "Time at which these statistics were last reset", nil },
99
109
},
100
-
"pg_stat_database" : map[string]ColumnMapping {
101
-
"datid" : { LABEL, "OID of a database", nil },
102
-
"datname" : { LABEL, "Name of this database", nil },
103
-
"numbackends" : { GAUGE, "Number of backends currently connected to this database. 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.", nil },
104
-
"xact_commit" : { COUNTER, "Number of transactions in this database that have been committed", nil },
105
-
"xact_rollback" : { COUNTER, "Number of transactions in this database that have been rolled back", nil },
106
-
"blks_read" : { COUNTER, "Number of disk blocks read in this database", nil },
107
-
"blks_hit" : { COUNTER, "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)", nil },
108
-
"tup_returned" : { COUNTER, "Number of rows returned by queries in this database", nil },
109
-
"tup_fetched" : { COUNTER, "Number of rows fetched by queries in this database", nil },
110
-
"tup_inserted" : { COUNTER, "Number of rows inserted by queries in this database", nil },
111
-
"tup_updated" : { COUNTER, "Number of rows updated by queries in this database", nil },
112
-
"tup_deleted" : { COUNTER, "Number of rows deleted by queries in this database", nil },
113
-
"conflicts" : { COUNTER, "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.)", nil },
114
-
"temp_files" : { COUNTER, "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.", nil },
115
-
"temp_bytes" : { COUNTER, "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.", nil },
116
-
"deadlocks" : { COUNTER, "Number of deadlocks detected in this database", nil },
117
-
"blk_read_time" : { COUNTER, "Time spent reading data file blocks by backends in this database, in milliseconds", nil },
118
-
"blk_write_time" : { COUNTER, "Time spent writing data file blocks by backends in this database, in milliseconds", nil },
119
-
"stats_reset" : { COUNTER, "Time at which these statistics were last reset", nil },
"datname" : { LABEL, "Name of this database", nil },
124
-
"confl_tablespace" : { COUNTER, "Number of queries in this database that have been canceled due to dropped tablespaces", nil },
125
-
"confl_lock" : { COUNTER, "Number of queries in this database that have been canceled due to lock timeouts", nil },
126
-
"confl_snapshot" : { COUNTER, "Number of queries in this database that have been canceled due to old snapshots", nil },
127
-
"confl_bufferpin" : { COUNTER, "Number of queries in this database that have been canceled due to pinned buffers", nil },
128
-
"confl_deadlock" : { COUNTER, "Number of queries in this database that have been canceled due to deadlocks", nil },
110
+
"pg_stat_database" : map[string]ColumnMapping {
111
+
"datid" : { LABEL, "OID of a database", nil },
112
+
"datname" : { LABEL, "Name of this database", nil },
113
+
"numbackends" : { GAUGE, "Number of backends currently connected to this database. 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.", nil },
114
+
"xact_commit" : { COUNTER, "Number of transactions in this database that have been committed", nil },
115
+
"xact_rollback" : { COUNTER, "Number of transactions in this database that have been rolled back", nil },
116
+
"blks_read" : { COUNTER, "Number of disk blocks read in this database", nil },
117
+
"blks_hit" : { COUNTER, "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)", nil },
118
+
"tup_returned" : { COUNTER, "Number of rows returned by queries in this database", nil },
119
+
"tup_fetched" : { COUNTER, "Number of rows fetched by queries in this database", nil },
120
+
"tup_inserted" : { COUNTER, "Number of rows inserted by queries in this database", nil },
121
+
"tup_updated" : { COUNTER, "Number of rows updated by queries in this database", nil },
122
+
"tup_deleted" : { COUNTER, "Number of rows deleted by queries in this database", nil },
123
+
"conflicts" : { COUNTER, "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.)", nil },
124
+
"temp_files" : { COUNTER, "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.", nil },
125
+
"temp_bytes" : { COUNTER, "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.", nil },
126
+
"deadlocks" : { COUNTER, "Number of deadlocks detected in this database", nil },
127
+
"blk_read_time" : { COUNTER, "Time spent reading data file blocks by backends in this database, in milliseconds", nil },
128
+
"blk_write_time" : { COUNTER, "Time spent writing data file blocks by backends in this database, in milliseconds", nil },
129
+
"stats_reset" : { COUNTER, "Time at which these statistics were last reset", nil },
129
130
},
130
131
}
131
132
132
133
// Turn the MetricMap column mapping into a prometheus descriptor mapping.
0 commit comments