spreaker / prometheus-pgbouncer-exporter

Prometheus exporter for PgBouncer
MIT License
104 stars 39 forks source link

Won't work with the docker swarm #47

Open Cyber-Cowboy opened 2 years ago

Cyber-Cowboy commented 2 years ago

Hi, after migrating from docker compose to docker swarm I noticed, that pgbouncer-exporter stopped working. It fails with the following error on start:

File "/usr/local/lib/python3.6/wsgiref/simple_server.py", line 153, in make_server
     server = server_class((host, port), handler_class)
   File "/usr/local/lib/python3.6/socketserver.py", line 456, in __init__
     self.server_bind()
   File "/usr/local/lib/python3.6/wsgiref/simple_server.py", line 50, in server_bind
     HTTPServer.server_bind(self)
   File "/usr/local/lib/python3.6/http/server.py", line 136, in server_bind
     socketserver.TCPServer.server_bind(self)
   File "/usr/local/lib/python3.6/socketserver.py", line 470, in server_bind
     self.socket.bind(self.server_address)
 socket.gaierror: [Errno -2] Name does not resolve

It appears, that it cannot handle service name in PGBOUNCER_EXPORTER_HOST setting, I replaced it with localhost and it started fine, but I cannot connect to it from other services(because it waits on localhost).

My settings are:

PGBOUNCER_EXPORTER_PORT={some port}
PGBOUNCER_USER={some_user}
PGBOUNCER_PASS={some_password}
PGBOUNCER_EXPORTER_HOST={pgbouncer_exporter_sevice_name}
PGBOUNCER_HOST={pgbouncer_sevice_name}
PGBOUNCER_PORT={pgbouncer_port}