Openhab-addons: [influxdb] influxdb 2.0 bucket is not saved in configuration

Created on 5 Nov 2020  ·  8Comments  ·  Source: openhab/openhab-addons

Current Behavior

Using influxdb 2.0 for persitence i got the following error.

2020-11-02 21:23:22.643 [ERROR] [.client.write.events.WriteErrorEvent] - The error occurred during writing of data com.influxdb.exceptions.NotFoundException: bucket "autogen" not found

Seams that the bindig tries to use the default Bucket/Retention Policy "autogen"

Your Environment

openHAB 3 build #2005; Debian 10.6; VM on Synology; Influx as Docker container

Solution

I checked the influx config profile and found that the correspondig entry “retentionProfile” /equals bucket in influx 2.0) is missing. Based on this the default value “autogen” is used. Adding the entry saves immideately entries to the database.

bug

All 8 comments

I'm in medical sick leave and I'm not able to verify/ work on that by now. But if you didn't enter a valid bucket name it works as expected.
The default value won't work if you don't create an autogen bucket when you install and configure Influx2

Hope you are getting well soon.

The problem is that the ucket value from ui ist not saved into the config. Workarounf is to add the key manually and everything works fine. I am nit sure if this is an UI issue or a binding issue. Just add:

retentionPolicy="<BucketName>"

in influxdb.config

I also had this issue and resolved it with TBail's solution.

What I found interesting was that the values I supplied for for Database/Organization and Retention Policy/Bucket are saved somewhere, despite not being found in influxdb.config.

image

That a good question. Maybe that is an Ui issue.

The value autogen is also set if you setup InfluxDB+Grafana within openhabian using openhabian-config.
But updating /etc/openhab/services/influxdb.cfg as mentioned using retentionPolicy=openhab has not solved the problem for me.

Instead I had to run following influx-commands additionally manually and reboot my Raspberry PI:

$ influx
Connected to http://localhost:8086 version 0.13
InfluxDB shell version: 0.13
> CREATE DATABASE openhab_db
> CREATE USER admin WITH PASSWORD 'SuperSecretPassword123+' WITH ALL PRIVILEGES
> CREATE USER openhab WITH PASSWORD 'AnotherSuperbPassword456-'
> CREATE USER grafana WITH PASSWORD 'PleaseLetMeRead789?'
> GRANT ALL ON openhab_db TO openhab
> GRANT READ ON openhab_db TO grafana
> exit

(from: https://community.openhab.org/t/influxdb-grafana-persistence-and-graphing/13761)

Also I had to update the persistence settings of openhab 3 in the new UI to InfluxDB 1 (instead Influx 2). Retention Policy/Bucket will be still at autogen.

IMHO it is the the flag to set InfluxDB 1 which solved the issue at least:

image

There are two problems reported here:

@TBail, @CrazyIvan359 CrazyIvan359 one:

I can't reproduce. I previously set up my configuration using the UI and it works for me.
I think that the problem can be mixing a text file migrated from OH 2 and the UI.
To my understanding, the UI doesn't update any files, and if you have a file it's possible that the UI updates its internal storage but then the entry from the file takes precedence.

To see if it's an addon problem and UI one, or bad use of mixing several configuration sources please can you run that on openhab console:

openhab> config:edit org.openhab.influxdb
openhab> config:property-list
   db = openhab
   retentionPolicy = origin
   token = ...
   url = ...
   user = admin
   version = V2
openhab> config:cancel
openhab>     

@stritti one:

The version value isn't a mandatory one and the default value is V1 to maintain backward compatibility.
If for any reason you had version to V2 is normal it didn't work for the installed InfluxDB version because it's 1.X.
In any case, it will be better to address in a separate issue and provide detailed steps to reproduce.

I have only used the UI to setup InfluxDB on OH3, with the exception of adding the retentionPolicy to ${USERDATA}/config/org/openhab/influxdb.config. Both OH3 and InfluxDB 2.0 were fresh installs when I started.

Here is the config as per Karaf for reference:

openhab> config:edit org.openhab.influxdb
openhab> config:property-list
   addLabelTag = true
   addTypeTag = true
   retentionPolicy = openhab
   token = SEh3YAUfYTH_UoTqGHDrIAy3q6Njv2aOdY2VQO9iuDYXmHMKJK1ZGcQ1VGkVtxxT1dok6XVFX9RsxXE9Z425VQ==
   url = http://influxdb2:8086
   version = V2

Thanks @TBail and @CrazyIvan359 .
I think that I've found the problem. There was an inconsistency in the retentionPolicy default value defined in code and the one in the descriptor (one had autogen and the other openhab).
And I think that it's possibly that you saw one value but the other was really saved.

Hope that the correction solves the problem.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DanielMalmgren picture DanielMalmgren  ·  5Comments

tobiwan88 picture tobiwan88  ·  4Comments

d3rh3ld picture d3rh3ld  ·  4Comments

smyrman picture smyrman  ·  4Comments

UrsusS picture UrsusS  ·  5Comments