agrif / OctoPrint-InfluxDB

Writes temperatures and events to an Influx database.
GNU Affero General Public License v3.0
24 stars 15 forks source link

Plugin cannot connect #10

Closed DerKnerd closed 4 years ago

DerKnerd commented 4 years ago

Hey @agrif,

thank you for that plugin. I really like the idea, but sadly it doesn't write anything to my hosted InfluxDB instance. The logs are empty and it shows no hint whether it is executed or not.

Did I maybe forgot to set a special setting somewhere? I attached you a picture of my config.

Greetings Knerd Screen Shot

DerKnerd commented 4 years ago

Little update, I do get a log entry at startup, that is why I missed it, here is the full entry:

2020-05-26 23:44:16,303 - octoprint.plugins.influxdb - INFO - connecting: database='octoprint', host='https://influx.ulbricht.cloud', port=443, ssl=True, use_udp=False, verify_ssl=False
2020-05-26 23:44:16,598 - octoprint.plugins.influxdb - ERROR - Cannot connect to InfluxDB server.
Traceback (most recent call last):
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_influxdb/__init__.py", line 60, in influx_try_connect
    db.ping()
  File "/home/pi/oprint/local/lib/python2.7/site-packages/influxdb/client.py", line 609, in ping
    expected_response_code=204
  File "/home/pi/oprint/local/lib/python2.7/site-packages/influxdb/client.py", line 333, in request
    timeout=self._timeout
  File "/home/pi/oprint/local/lib/python2.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
ConnectionError: HTTPSConnectionPool(host='https', port=443): Max retries exceeded with url: //influx.ulbricht.cloud:443/ping (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x6e965e50>: Failed to establish a new connection: [Errno -2] Name or service not known',))
agrif commented 4 years ago

Hello! Sorry for the late reply. Try using a bare hostname in the server field, e.g. example.local instead of https://example.local.

I've never seen an InfluxDB instance hosted on anything but the toplevel of a domain, but I suppose that might be an issue in the future. For now, though, I'll change the wording on the settings page to reflect that this should be a hostname, not a URL.

(If this doesn't fix your issue, please re-open!)