In my (simplified) setup, I have 2 Servers, A and B (and others, which behave like B), and my local machine. On each of the servers, a mysql
-database and a mysqld-exporter
prometheus-exporter should be running as docker containers. The containers are not linked, but communicate via the network over the opened port.
The servers are managed by a tool, and therefore contain the same versions of the programs with the same configs, like ports, docker network name. The difference are hostnames, ip addresses and other server-specific stuff.
The problem is, that the mysqld-exporter
on server A
produces the log message: level=error msg="Error pinging mysqld: dial tcp SERVER_IP_ADDRESS:3306: getsockopt: connection timed out" source="mysqld_exporter.go:268"
(where SERVER_IP_ADDRESS is the server's ip), while the exporter on B
works fine.
I also tried to create the container "by hand", with docker run
, and set the DATA_SOURCE_NAME
as environment variable, on server A
, B
and locally to connect to server A
. Now, the container works and connects to server A as expected from my local machine and from server B
, but still not from A
. Therefore, I assume the database works fine (not overloaded).
What are reasons why the docker-container doesn't work on machine A
? I run out of ideas what to look for.
If any necessary information is missing, please let me know!
EDIT:
With "by hand", I mean the docker-command docker run -d -p 9104:9104 -e DATA_SOURCE_NAME="USERNAME:PASSWORD@(SERVER_URL:MYSQL_PORT)/" prom/mysqld-exporter:v0.10.0
executed in the console, which works to connect to A from B and localhost, but not A.
As explained, the server URL should also work on server A, since B and localhost use the same url to connect to the database.