This is a simple exporter for PgBouncer that makes several metrics available to Prometheus.
Metrics are exported from the SHOW LISTS, STATS, POOLS and DATABASES comand output.
View metricsYou must configure Prometheus to scrape the metrics exported here. The port is 9127, and the configuration should look something like the example below.
scrape_configs:
- job_name: pgbouncer
target_groups:
- targets:
- MACHINE_ADDRESS:9127
Copyright (C) 2015 Christopher Baines
View Licence
The source may be obtained from this Git repository
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
""" def create_request_handler(licence_location): class RequestHandler(MetricsHandler): def do_GET(self): if self.path == "/metrics": return super().do_GET() self.send_response(200) self.end_headers() if self.path == "/licence": with open( licence_location, 'rb', ) as licence: self.wfile.write(licence.read()) else: self.wfile.write(index_page.encode('UTF-8')) return RequestHandler prometheus-pgbouncer-exporter-1.4/prometheus_pgbouncer_exporter/utils.py 0000664 0000000 0000000 00000002756 12661056647 0027331 0 ustar 00root root 0000000 0000000 #!/usr/bin/python3 # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see