Skip to content

Commit 4ba5868

Browse files
authored
fix: fix reserve_pool column name change for show databases (#465)
* fix: fix reserve_pool column name change for show databases * fix: update pgbouncer collector file version * docs: update docs for bouncer files
1 parent 714a65a commit 4ba5868

3 files changed

Lines changed: 202 additions & 1 deletion

File tree

changelogs/fragments/464.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bugfixes:
2+
- sql_exporter - Create new collections file for pgBouncer 1.24+

hugo/content/exporter/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ CREATE EXTENSION pg_stat_statements;
181181
| crunchy_per_db_collector.yml | Collection file with general per-database level queries and metrics |
182182
| crunchy_pg_stat_statements_collector.yml | Collection file with pg_stat_statements queries and metrics
183183
| crunchy_pg_stat_statements_reset_collector.yml | Collection file with options to allow resetting of pg_stat_statements metrics |
184-
| crunchy_pgbouncer_collector_121.yml | Collection file with pgBouncer queries and metrics for a minimum version of 1.21 |
184+
| crunchy_pgbouncer_collector_*.yml | Collection files for pgBouncer queries and metrics. The number suffix on the filename is the minimum version of pgBouncer required for that file. If there is a newer version file available, that one must be used if that version of pgBouncer or greater is running. Example: collector_121.yml requires at least pgBouncer 1.21. But there is also a collector_124.yml file, so if you are running pgBouncer 1.24+, you must use the 124 file. Note that a newer file will only be created if necessary to support changes in the pgBouncer API. |
185185

186186

187187
Run the `setup_db.sql` file on all databases that will be monitored by pgMonitor. At minimum this must be at least the global database so the necessary database objects are created. The `pgmonitor-extension` is expected to be available to be installed in the target database(s) when running this file. Note the `setup_db.sql` file is a convenience file and the steps contained within it can be done manually and customized as needed. Note that a default password is not set for the `ccp_monitoring` database role.
Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
collector_name: crunchy_pgbouncer_124
2+
# Collector for PgBouncer minimum version of 1.24
3+
4+
metrics:
5+
- metric_name: ccp_pgbouncer_clients_wait_seconds
6+
type: gauge
7+
help: "Current waiting time in seconds"
8+
values: [wait]
9+
key_labels:
10+
- database
11+
- user
12+
- state
13+
- application_name
14+
- link
15+
query_ref: ccp_pgbouncer_clients
16+
17+
18+
- metric_name: ccp_pgbouncer_databases_pool_size
19+
type: gauge
20+
help: "Maximum number of server connections"
21+
values: [pool_size]
22+
key_labels:
23+
- name
24+
- host
25+
- port
26+
- database
27+
- force_user
28+
- pool_mode
29+
query_ref: ccp_pgbouncer_databases
30+
- metric_name: ccp_pgbouncer_databases_min_pool_size
31+
type: gauge
32+
help: "Minimum number of server connections"
33+
values: [min_pool_size]
34+
key_labels:
35+
- name
36+
- host
37+
- port
38+
- database
39+
- force_user
40+
- pool_mode
41+
query_ref: ccp_pgbouncer_databases
42+
- metric_name: ccp_pgbouncer_databases_reserve_pool_size
43+
type: gauge
44+
help: "Maximum number of additional connections for this database"
45+
values: [reserve_pool_size]
46+
key_labels:
47+
- name
48+
- host
49+
- port
50+
- database
51+
- force_user
52+
- pool_mode
53+
query_ref: ccp_pgbouncer_databases
54+
- metric_name: ccp_pgbouncer_databases_max_connections
55+
type: gauge
56+
help: "Maximum number of allowed connections for this database, as set by max_db_connections, either globally or per database"
57+
values: [max_connections]
58+
key_labels:
59+
- name
60+
- host
61+
- port
62+
- database
63+
- force_user
64+
- pool_mode
65+
query_ref: ccp_pgbouncer_databases
66+
- metric_name: ccp_pgbouncer_databases_current_connections
67+
type: gauge
68+
help: "Current number of connections for this database"
69+
values: [current_connections]
70+
key_labels:
71+
- name
72+
- host
73+
- port
74+
- database
75+
- force_user
76+
- pool_mode
77+
query_ref: ccp_pgbouncer_databases
78+
- metric_name: ccp_pgbouncer_databases_paused
79+
type: gauge
80+
help: "1 if this database is currently paused, else 0"
81+
values: [paused]
82+
key_labels:
83+
- name
84+
- host
85+
- port
86+
- database
87+
- force_user
88+
- pool_mode
89+
query_ref: ccp_pgbouncer_databases
90+
- metric_name: ccp_pgbouncer_databases_disabled
91+
type: gauge
92+
help: "1 if this database is currently disabled, else 0"
93+
values: [disabled]
94+
key_labels:
95+
- name
96+
- host
97+
- port
98+
- database
99+
- force_user
100+
- pool_mode
101+
query_ref: ccp_pgbouncer_databases
102+
103+
104+
- metric_name: ccp_pgbouncer_lists_item_count
105+
type: gauge
106+
help: "Count of items registered with pgBouncer"
107+
values: [items]
108+
key_labels:
109+
- list
110+
query_ref: ccp_pgbouncer_lists
111+
112+
113+
- metric_name: ccp_pgbouncer_pools_client_active
114+
type: gauge
115+
help: "Client connections that are either linked to server connections or are idle with no queries waiting to be processed"
116+
values: [cl_active]
117+
key_labels:
118+
- database
119+
- user
120+
query_ref: ccp_pgbouncer_pools
121+
- metric_name: ccp_pgbouncer_pools_client_waiting
122+
type: gauge
123+
help: "Client connections that have sent queries but have not yet got a server connection"
124+
values: [cl_waiting]
125+
key_labels:
126+
- database
127+
- user
128+
query_ref: ccp_pgbouncer_pools
129+
- metric_name: ccp_pgbouncer_pools_server_active
130+
type: gauge
131+
help: "Server connections that are linked to a client"
132+
values: [sv_active]
133+
key_labels:
134+
- database
135+
- user
136+
query_ref: ccp_pgbouncer_pools
137+
- metric_name: ccp_pgbouncer_pools_server_idle
138+
type: gauge
139+
help: "Server connections that are unused and immediately usable for client queries"
140+
values: [sv_idle]
141+
key_labels:
142+
- database
143+
- user
144+
query_ref: ccp_pgbouncer_pools
145+
- metric_name: ccp_pgbouncer_pools_server_used
146+
type: gauge
147+
help: "Server connections that have been idle for more than server_check_delay, so they need server_check_query to run on them before they can be used again"
148+
values: [sv_used]
149+
key_labels:
150+
- database
151+
- user
152+
query_ref: ccp_pgbouncer_pools
153+
154+
155+
- metric_name: ccp_pgbouncer_servers_close_needed
156+
type: gauge
157+
help: "1 if the connection will be closed as soon as possible, because a configuration file reload or DNS update changed the connection information or RECONNECT was issued"
158+
values: [close_needed]
159+
key_labels:
160+
- database
161+
- user
162+
- state
163+
- application_name
164+
- link
165+
query_ref: ccp_pgbouncer_servers
166+
167+
168+
########## QUERIES ##########
169+
queries:
170+
- query_name: ccp_pgbouncer_clients
171+
no_prepared_statement: true
172+
query: |
173+
SHOW CLIENTS;
174+
175+
- query_name: ccp_pgbouncer_databases
176+
no_prepared_statement: true
177+
query: |
178+
SHOW DATABASES;
179+
180+
- query_name: ccp_pgbouncer_lists
181+
no_prepared_statement: true
182+
query: |
183+
SHOW LISTS;
184+
185+
- query_name: ccp_pgbouncer_pools
186+
no_prepared_statement: true
187+
query: |
188+
SHOW POOLS;
189+
190+
- query_name: ccp_pgbouncer_servers
191+
no_prepared_statement: true
192+
query: |
193+
SHOW SERVERS;
194+
195+
# Add later if needed
196+
# - query_name: ccp_pgbouncer_stats
197+
# no_prepared_statement: true
198+
# query: |
199+
# SHOW STATS;

0 commit comments

Comments
 (0)