breadlysm / SpeedFlux

Script to periodically run the Speedtest CLI application by Ookla and post results to InfluxDB.
MIT License
108 stars 69 forks source link

Max retries exceeded with url: /query?q=SHOW+DATABASES #9

Closed data-source closed 3 years ago

data-source commented 3 years ago

Hi,

Been using the script with Grafana for the last 6 months without any issue, however, ran into this and can't seem to get passed it.

`During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/admin/speedtest-to-influxdb/./main.py", line 41, in main() File "/Users/admin/speedtest-to-influxdb/./main.py", line 12, in main influx = Influx(config) File "/Users/admin/speedtest-to-influxdb/speedflux/influx.py", line 14, in init self.init_db() File "/Users/admin/speedtest-to-influxdb/speedflux/influx.py", line 17, in init_db databases = self.client.get_list_database() File "/usr/local/lib/python3.9/site-packages/influxdb/client.py", line 704, in get_list_database return list(self.query("SHOW DATABASES").get_points()) File "/usr/local/lib/python3.9/site-packages/influxdb/client.py", line 521, in query response = self.request( File "/usr/local/lib/python3.9/site-packages/influxdb/client.py", line 332, in request response = self._session.request( File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 542, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 655, in send r = adapter.send(request, kwargs) File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 516, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.1.15', port=8088): Max retries exceeded with url: /query?q=SHOW+DATABASES (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x111041a30>: Failed to establish a new connection: [Errno 61] Connection refused'))`

Updated the script to latest version, same issue

Thanks

breadlysm commented 3 years ago

I'm going to add some more logging around that section of code later today but, can you confirm that Influx is receiving data from other sources?

And to confirm this started happening before you updated the script?

breadlysm commented 3 years ago

@data-source I did make an update with improved error logging. However, the only way I could reproduce that error was if I provided an invalid hostname or if influx was not up and running. It's an error that represents the two systems can't talk to each other.

It could also be a corrupt DB. If you have Chronograf installed, you could see if there are any problems with the InfluxDB from there.

Also ensure the docker network is properly running.

data-source commented 3 years ago

Sorry for the delay, spent some time to try and find out what happened but basically brew made a mess of the whole thing, as usual, after I tried an update. The .plist that launches the service had the wrong path, the original influxdb2 folder is now gone, and permissions were incorrect.

Tried to reinstall, etc, set the correct paths but brew won't start influxb at all, so I'll have to reinstall manually.

Here's what I had until now:
May 29 15:02:36 mms02 com.apple.xpc.launchd[1] (homebrew.mxcl.influxdb[5812]): Could not find and/or execute program specified by service: 2: No such file or directory: /usr/local/Cellar/influxdb/2.0.6_2/bin/influxd May 29 15:02:36 mms02 com.apple.xpc.launchd[1] (homebrew.mxcl.influxdb[5812]): Service setup event to handle failure and will not launch until it fires. May 29 15:03:06 mms02 Dock[296]: DEPRECATED USE in libdispatch client: Setting timer interval to 0 requests a 1ns timer, did you mean FOREVER (a one-shot timer)? May 29 15:03:23 mms02 com.apple.xpc.launchd[1] (com.apple.imfoundation.IMRemoteURLConnectionAgent): Unknown key for integer: _DirtyJetsamMemoryLimit May 29 15:03:43 --- last message repeated 2 times --- May 29 15:03:43 mms02 diagnosticd[5954]: no EOS device present May 29 15:03:43 mms02 diagnosticd[5954]: System mode client started - Console (5953) - mode: 0xb May 29 15:03:51 mms02 Console[5953]: BUG in libdispatch client: kevent[vnode] monitored resource vanished before the source cancel handler was invoked

data-source commented 3 years ago

Reinstalled from scratch, it's running on 8086: curl -sL -I localhost:8086/ping HTTP/1.1 204 No Content Content-Type: application/json Request-Id: ded5509a-c08a-11eb-8001-c82a1455626a X-Influxdb-Build: OSS X-Influxdb-Version: 1.8.3 X-Request-Id: ded5509a-c08a-11eb-8001-c82a1455626a Date: Sat, 29 May 2021 14:33:44 GMT

Launching the script though still getting this: During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/admin/speedtest-to-influxdb/./main.py", line 41, in main() File "/Users/admin/speedtest-to-influxdb/./main.py", line 12, in main influx = Influx(config) File "/Users/admin/speedtest-to-influxdb/speedflux/influx.py", line 14, in init self.init_db() File "/Users/admin/speedtest-to-influxdb/speedflux/influx.py", line 17, in init_db databases = self.client.get_list_database() File "/usr/local/lib/python3.9/site-packages/influxdb/client.py", line 704, in get_list_database return list(self.query("SHOW DATABASES").get_points()) File "/usr/local/lib/python3.9/site-packages/influxdb/client.py", line 521, in query response = self.request( File "/usr/local/lib/python3.9/site-packages/influxdb/client.py", line 332, in request response = self._session.request( File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 542, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 655, in send r = adapter.send(request, kwargs) File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 516, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='influxdb', port=8086): Max retries exceeded with url: /query?q=SHOW+DATABASES (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x102436070>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))

Will reinstall that part too completely.

data-source commented 3 years ago

Fixed after recreating the db from scratch. Thanks