InfluxDB Connection Refused inconsistently

I set up a small server monitoring script based on the Python tutorial in the GUI. I cloned the code repo into about 10 servers. Some connect fine, some give an error: “Failed to establish a new connection: [Errno 111] Connection refused”.

I’ve checked the configs and tokens, everything is identical. The code is all identical from the same repo. I don’t even know what to check from here.

— Edit —

I went through 8 of the servers. 5 connect fine. 1 gives a Connection Timed Out error, 2 give Connection Refused errors. All of the code and API tokens are identical.

There’s a couple possible thoughts that come to mind:

  • You’re running pre-existing instances of InfluxDB on the servers that are failing, causing the default port to be unavailable. Even with the same code, if a port is already occupied, the InfluxDB instance will increment to the next available port, which would cause an error as you try to connect to some prior instance.
  • The servers that aren’t working have a poor network connection.

If that’s not it, then I’m not entirely sure what the culprit may be. But if you’ve gotten it working on some servers and not others, then you can be relatively confident that the servers it’s not working on have something different about them, and it’s just about figuring out what that something is.