jomjol / AI-on-the-edge-device

Easy to use device for connecting "old" measuring units (water, power, gas, ...) to the digital world
https://jomjol.github.io/AI-on-the-edge-device-docs/
6.09k stars 654 forks source link

Influxdb1 config uses V2 api calls #2203

Closed srLinux closed 1 year ago

srLinux commented 1 year ago

The Problem

Hi,

I have configured InfluxDBv1 and it does not work. I checked the logs and noticed that the API URI: is http://192.168.10.17:8086/api/v2/write?bucket=test/ which looks like it is for v2 type of database.

Version

Release: v15.1.0 (Commit: 7d33c3e+)

Logfile

[0d00h18m47s] 2023-03-17T01:55:11 <INF> [INFLUXDB] sending line to influxdb:watermeter main/value=196.9301 1679014486000000000
[0d00h18m47s] 2023-03-17T01:55:11 <INF> [INFLUXDB] API URI: http://192.168.10.17:8086/api/v2/write?bucket=test/
[0d00h18m47s] 2023-03-17T01:55:11 <DBG> [INFLUXDB] client is initialized
[0d00h18m47s] 2023-03-17T01:55:11 <DBG> [INFLUXDB] header is set
[0d00h18m47s] 2023-03-17T01:55:11 <DBG> [INFLUXDB] post payload is set
[0d00h18m47s] 2023-03-17T01:55:11 <DBG> [INFLUXDB] HTTP Client Error encountered
[0d00h18m47s] 2023-03-17T01:55:11 <DBG> [INFLUXDB] HTTP Client sent all request headers

Expected Behavior

something like http://192.168.10.17:8086/write?db=test'

Screenshots

No response

Additional Context

No response

jomjol commented 1 year ago

This has way has been implemented since the very first version: https://github.com/jomjol/AI-on-the-edge-device/commit/eb53db00d07df0eff36dc4f9fa8791eb286ac42a#diff-d3856a99d7b6cab0d2e1eae90aa70a1a8fda60e1c56051a0431d2458c5e8f602

Are you sure, that the problem is in the code and not in the database itself?

srLinux commented 1 year ago

Hi, take a look here:

https://docs.influxdata.com/influxdb/v1.8/guides/write_data/#

To write to a database using the InfluxDB 1.8 API = curl -i -XPOST 'http://localhost:8086/write?db=mydb' To write to a database using the InfluxDB 2.0 API = curl -i -XPOST 'http://localhost:8086/api/v2/write?bucket=db'

But i can live with my workaround to collect the topic from mqtt via telegraf. The document says api calls for v2 are compatible in version 1.8+ idk if they mean including the 1.8 or since 2.0 :-)

jomjol commented 1 year ago

I have modified the latest rolling. Can you check?

srLinux commented 1 year ago

hi there, sadly not fixed cause tailing /

[0d00h00m50s] 2023-03-23T21:54:53 [INFLUXDB] API URI: http://192.168.10.17:8086/write?db=test/ [...] [0d00h00m50s] 2023-03-23T21:54:53 [INFLUXDB] Header: key=X-Influxdb-Error, value=database not found: "test/"

srLinux commented 1 year ago

Fixed in PR #2233 thank you!

srLinux commented 1 year ago

@caco3 i am new to github, can you please tell my why you closed the issue? i made a mistake?

caco3 commented 1 year ago

@srLinux It got automatically closed because I referred to it in PR https://github.com/jomjol/AI-on-the-edge-device/pull/2233

srLinux commented 1 year ago

I have understood, thank you :-)

glennsen commented 1 year ago

If it’s not too much of an effort, could you make the current rolling a bug fix release? I wasn’t able to build it by myself on a mac :(, and now I’m missing values from my counters since 5 days with having 15.1.1 running.

caco3 commented 1 year ago

@glennsen Until we add it to a new bugfix release, you can use https://github.com/jomjol/AI-on-the-edge-device/actions?query=branch%3Afix-influxDBv1-trailing-slash

just use the update zip for the update as if it were a normal release.

dg7pc commented 1 year ago

@glennsen Until we add it to a new bugfix release, you can use https://github.com/jomjol/AI-on-the-edge-device/actions?query=branch%3Afix-influxDBv1-trailing-slash

just use the update zip for the update as if it were a normal release.

Thanks!

For the record: With v15.1.1 I did not even see any TCP Packet coming on the InfluxDB host coming in. With above hotfix I get my data again.