-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from keithf4/v0.4
v0.4 - Update to support pgbouncer 1.16
- Loading branch information
Showing
6 changed files
with
520 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
default_version = '0.3' | ||
default_version = '0.4' | ||
comment = 'Extension for querying pgbouncer stats from normal SQL views & running pgbouncer commands from normal SQL functions' | ||
requires = dblink | ||
relocatable = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,22 @@ | ||
|
||
CREATE VIEW @[email protected]_clients AS | ||
SELECT * FROM dblink('pgbouncer', 'show clients') AS x | ||
SELECT type | ||
, "user" | ||
, database | ||
, state | ||
, addr | ||
, port | ||
, local_addr | ||
, local_port | ||
, connect_time | ||
, request_time | ||
, wait | ||
, wait_us | ||
, close_needed | ||
, ptr | ||
, link | ||
, remote_pid | ||
, tls | ||
FROM dblink('pgbouncer', 'show clients') AS x | ||
( type text | ||
, "user" text | ||
, database text | ||
|
@@ -19,50 +35,97 @@ CREATE VIEW @[email protected]_clients AS | |
, remote_pid int | ||
, tls text); | ||
|
||
|
||
CREATE VIEW @[email protected]_config AS | ||
SELECT * FROM dblink('pgbouncer', 'show config') AS x | ||
SELECT key | ||
, value | ||
, "default" | ||
, changeable | ||
FROM dblink('pgbouncer', 'show config') AS x | ||
( key text | ||
, value text | ||
, "default" text | ||
, changeable boolean); | ||
|
||
|
||
CREATE VIEW @[email protected]_databases AS | ||
SELECT * FROM dblink('pgbouncer', 'show databases') AS x | ||
SELECT name | ||
, host | ||
, port | ||
, database | ||
, force_user | ||
, pool_size | ||
, min_pool_size | ||
, reserve_pool | ||
, pool_mode | ||
, max_connections | ||
, current_connections | ||
, paused | ||
, disabled | ||
FROM dblink('pgbouncer', 'show databases') AS x | ||
( name text | ||
, host text | ||
, port int | ||
, database text | ||
, force_user text | ||
, pool_size int | ||
, min_pool_size int | ||
, reserve_pool int | ||
, pool_mode text | ||
, max_connections int | ||
, current_connections int | ||
, paused int | ||
, disabled int); | ||
|
||
|
||
CREATE VIEW @[email protected]_dns_hosts AS | ||
SELECT * FROM dblink('pgbouncer', 'show dns_hosts') AS x | ||
SELECT hostname | ||
, ttl | ||
, addrs | ||
FROM dblink('pgbouncer', 'show dns_hosts') AS x | ||
( hostname text | ||
, ttl bigint | ||
, addrs text); | ||
|
||
|
||
CREATE VIEW @[email protected]_dns_zones AS | ||
SELECT * FROM dblink('pgbouncer', 'show dns_zones') AS x | ||
SELECT zonename | ||
, serial | ||
, count | ||
FROM dblink('pgbouncer', 'show dns_zones') AS x | ||
( zonename text | ||
, serial text | ||
, count int); | ||
|
||
|
||
CREATE VIEW @[email protected]_lists AS | ||
SELECT * FROM dblink('pgbouncer', 'show lists') AS x | ||
SELECT list | ||
, items | ||
FROM dblink('pgbouncer', 'show lists') AS x | ||
( list text | ||
, items int); | ||
|
||
|
||
CREATE VIEW @[email protected]_pools AS | ||
SELECT * FROM dblink('pgbouncer', 'show pools') AS x | ||
SELECT database | ||
, "user" | ||
, cl_active | ||
, cl_waiting | ||
, cl_cancel_req | ||
, sv_active | ||
, sv_idle | ||
, sv_used | ||
, sv_tested | ||
, sv_login | ||
, maxwait | ||
, maxwait_us | ||
, pool_mode | ||
FROM dblink('pgbouncer', 'show pools') AS x | ||
( database text | ||
, "user" text | ||
, cl_active int | ||
, cl_waiting int | ||
, cl_cancel_req int | ||
, sv_active int | ||
, sv_idle int | ||
, sv_used int | ||
|
@@ -72,8 +135,26 @@ CREATE VIEW @[email protected]_pools AS | |
, maxwait_us int | ||
, pool_mode text); | ||
|
||
|
||
CREATE VIEW @[email protected]_servers AS | ||
SELECT * FROM dblink('pgbouncer', 'show servers') AS x | ||
SELECT type | ||
, "user" | ||
, database | ||
, state | ||
, addr | ||
, port | ||
, local_addr | ||
, local_port | ||
, connect_time | ||
, request_time | ||
, wait | ||
, wait_us | ||
, close_needed | ||
, ptr | ||
, link | ||
, remote_pid | ||
, tls | ||
FROM dblink('pgbouncer', 'show servers') AS x | ||
( type text | ||
, "user" text | ||
, database text | ||
|
@@ -92,8 +173,33 @@ CREATE VIEW @[email protected]_servers AS | |
, remote_pid int | ||
, tls text); | ||
|
||
|
||
CREATE VIEW @[email protected]_sockets AS | ||
SELECT * FROM dblink('pgbouncer', 'show sockets') AS x | ||
SELECT type | ||
, "user" | ||
, database | ||
, state | ||
, addr | ||
, port | ||
, local_addr | ||
, local_port | ||
, connect_time | ||
, request_time | ||
, wait | ||
, wait_us | ||
, close_needed | ||
, ptr | ||
, link | ||
, remote_pid | ||
, tls | ||
, recv_pos | ||
, pkt_pos | ||
, pkt_remain | ||
, send_pos | ||
, send_remain | ||
, pkt_avail | ||
, send_avail | ||
FROM dblink('pgbouncer', 'show sockets') AS x | ||
( type text | ||
, "user" text | ||
, database text | ||
|
@@ -119,8 +225,24 @@ CREATE VIEW @[email protected]_sockets AS | |
, pkt_avail int | ||
, send_avail int); | ||
|
||
|
||
CREATE VIEW @[email protected]_stats AS | ||
SELECT * FROM dblink('pgbouncer', 'show stats') AS x | ||
SELECT database | ||
, total_xact_count | ||
, total_query_count | ||
, total_received | ||
, total_sent | ||
, total_xact_time | ||
, total_query_time | ||
, total_wait_time | ||
, avg_xact_count | ||
, avg_query_count | ||
, avg_recv | ||
, avg_sent | ||
, avg_xact_time | ||
, avg_query_time | ||
, avg_wait_time | ||
FROM dblink('pgbouncer', 'show stats') AS x | ||
( database text | ||
, total_xact_count bigint | ||
, total_query_count bigint | ||
|
@@ -137,8 +259,10 @@ CREATE VIEW @[email protected]_stats AS | |
, avg_query_time bigint | ||
, avg_wait_time bigint ); | ||
|
||
|
||
CREATE VIEW @[email protected]_users AS | ||
SELECT * FROM dblink('pgbouncer', 'show users') AS x | ||
SELECT name | ||
, pool_mode | ||
FROM dblink('pgbouncer', 'show users') AS x | ||
( name text | ||
, pool_mode text); | ||
|
Oops, something went wrong.