InfluxDB+Grafana persistence and graphing

I created this pull request: https://github.com/wborn/openhab-grafana/pull/28

I hope, this is OK, I am not familiar with the Github workflow.

More FYI for those wo might be trying with OpenhabianPi:

I am on a Raspberry P3, I have used the OH image and configured OH3.

I then used the openhabian-config tool to install Influx & Grafana.

During that install it asked for passwords for admin, openhab, grafana.

It also asked for the database name.

I ran infux in the terminal.

It responded with:

Connected to http://localhost:8086 version 1.8.6
InfluxDB shell version: 1.8.6

The instructions here to create a database. Was it not created by the name provided during the install?
The instructions say create a admin, openhab, and grafana user/passord. Were they not created during the install?

At the influx command prompt:

>use <db_name given during install>

returns:

ERR: unable to parse authentication credentials
DB does not exist!

Oh, using the command auth and providing the admin name/password works
and use <db_name given during install> responds:

Using database db_name given during install>

Also, the [http] section is already set.

And, I killed the python script at 430 points


Running OH2.5 on RPi3. Influxdb installation went smoothly, but I am getting errors when installing grafana using the instructions provided (screenshot below). Could someone please help?

a) aren’t packages from a jessie repository a bit outdated on a buster system ?
b) I assume that the grafana repo isn’t hosted any longer on bintray. Did you check for repos on grafana.com ?

1 Like

Indeed you are right. Followed instructions from the following link and I was able to get it up and running:

1 Like

Today I gave Grafana 8 another try. I started with your pull request, forked my own repository of it to be able to run the github actions, fixed a trailing whitespace to make the autobuilder happy and then used the web/openhab-grafana.js, that was generated (https://github.com/RolandRosenfeld/openhab-grafana/blob/main/web/openhab-grafana.js).

After this, I changed the board name to the board ID and tried the result.

With basic-UI on my PC this seems to work as expected, but with the Android app, I wasn’t able to see a graph


No idea, what’s going wrong, but again I had to downgrade to 7.5.11

I have influxDB running on an Ubuntu server machine and it is communicating with openHAB (I can within influx graph several variables from OH). But I cannot set up communication between influx and Grafana.

When in the influx terminal I cannot execute any commands; all respond with “ERR: received status code 401 from server”. Therefore I’m unable to set up a “grafana” user and pw within influx (I suspect this is why Grafana cannot query influx).

When logging into the terminal I’m greeted with the following text:
Connected to http://localhost:8086 version 2.1.1
InfluxDB shell version: 1.6.4

I read somewhere a mismatch between the DB and shell can cause issues. Is that my problem here or do I have other problems?

Hi All,
do you know of any way to migrate the rrdj4 (10 month of data) of OH 3.2 to InfluxDB 2.1.1 (2 days of data)?

All my setup is running via docker containers (OH3.2, InfluxDB2.1.1 and Grafana 8.3.3 among other things). From OH 3.2 I am able to write to the InfluxDB2, and from Grafana I am able to read the InfluxDB and create dashboards accordingly.

Thank you and happy new year
Espresso

Hi,

I installed Influx and Grafana today on the latest OH3 version (see details at the bottom). Everything pretty standard. Worked everything smoothly. Had the first dashboard already running with HUE motion sensors and Netatmo temp sensors.

Then I rebooted my RaspPi and Influx&Grafana are not accessible anymore


The only thing I changed while I was configuring in 192.168.278.111:3000 was that I renamed the admin username to a different one in Grafana. I was assuming this is stored in a config file.

I did not edit any config file.

Enclosed a log from the journal.

I would have assumed that when I restart the Raspi Influx and Grafana would run like before
what do I need to do to get it going again?

BR
Alex

-- Journal begins at Wed 2022-01-05 15:22:41 CET, ends at Thu 2022-01-06 19:20:24 CET. --
Jan 06 18:51:36 openhabian systemd[1]: Starting InfluxDB is an open-source, distributed, time series database...
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[864]: Merging with configuration at: /etc/influxdb/influxdb.conf
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:51:42.316341Z lvl=info msg="InfluxDB starting" log_id=0Yt87tw0000 version=1.8.10 branch=1.8 commit=688e697c51fd
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:51:42.316416Z lvl=info msg="Go runtime" log_id=0Yt87tw0000 version=go1.13.8 maxprocs=4
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[1049]: Merging with configuration at: /etc/influxdb/influxdb.conf
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:51:42.510145Z lvl=info msg="Using data dir" log_id=0Yt87tw0000 service=store path=/var/lib/influxdb/data
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:51:42.510511Z lvl=info msg="Compaction settings" log_id=0Yt87tw0000 service=store max_concurrent_compactions=2 throughput_bytes_per_second=50331648 throughput_bytes_per_second_burst=50331648
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:51:42.510579Z lvl=info msg="Open store (start)" log_id=0Yt87tw0000 service=store trace_id=0Yt87ugW000 op_name=tsdb_open op_event=start
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:51:42.510720Z lvl=info msg="Open store (end)" log_id=0Yt87tw0000 service=store trace_id=0Yt87ugW000 op_name=tsdb_open op_event=end op_elapsed=0.145ms
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:51:42.573335Z lvl=info msg="Opened service" log_id=0Yt87tw0000 service=subscriber
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:51:42.573422Z lvl=info msg="Starting monitor service" log_id=0Yt87tw0000 service=monitor
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:51:42.573461Z lvl=info msg="Registered diagnostics client" log_id=0Yt87tw0000 service=monitor name=build
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:51:42.573494Z lvl=info msg="Registered diagnostics client" log_id=0Yt87tw0000 service=monitor name=runtime
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:51:42.573522Z lvl=info msg="Registered diagnostics client" log_id=0Yt87tw0000 service=monitor name=network
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:51:42.573561Z lvl=info msg="Registered diagnostics client" log_id=0Yt87tw0000 service=monitor name=system
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:51:42.573610Z lvl=info msg="Starting precreation service" log_id=0Yt87tw0000 service=shard-precreation check_interval=10m advance_period=30m
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:51:42.573654Z lvl=info msg="Starting snapshot service" log_id=0Yt87tw0000 service=snapshot
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:51:42.583841Z lvl=info msg="Starting continuous query service" log_id=0Yt87tw0000 service=continuous_querier
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:51:42.646744Z lvl=info msg="Starting HTTP service" log_id=0Yt87tw0000 service=httpd authentication=true
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:51:42.646910Z lvl=info msg="opened HTTP access log" log_id=0Yt87tw0000 service=httpd path=stderr
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:51:42.646955Z lvl=info msg="Auth is enabled but shared-secret is blank. BearerAuthentication is disabled." log_id=0Yt87tw0000 service=httpd
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[857]: InfluxDB API unavailable after 1 attempts...
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:51:42.892327Z lvl=info msg="Listening on HTTP" log_id=0Yt87tw0000 service=httpd addr=127.0.0.1:8086 https=false
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:51:42.916257Z lvl=info msg="Starting retention policy enforcement service" log_id=0Yt87tw0000 service=retention check_interval=30m
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:51:42.917377Z lvl=info msg="Listening for signals" log_id=0Yt87tw0000
Jan 06 18:51:42 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:51:42.917053Z lvl=info msg="Sending usage statistics to usage.influxdata.com" log_id=0Yt87tw0000
Jan 06 18:51:43 openhabian influxd-systemd-start.sh[861]: [httpd] 127.0.0.1 - - [06/Jan/2022:18:51:43 +0100] "GET /health HTTP/1.1" 200 107 "-" "curl/7.74.0" 4f6ebf5d-6f19-11ec-8001-e45f01610c46 341
Jan 06 18:51:43 openhabian influxd-systemd-start.sh[857]: InfluxDB started
Jan 06 18:51:43 openhabian systemd[1]: Started InfluxDB is an open-source, distributed, time series database.
Jan 06 18:52:24 openhabian influxd-systemd-start.sh[861]: [httpd] 127.0.0.1 - openhab [06/Jan/2022:18:52:24 +0100] "GET /ping HTTP/1.1" 204 0 "-" "okhttp/3.14.9" 67c13d43-6f19-11ec-8002-e45f01610c46 50
Jan 06 18:52:24 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:52:24.888678Z lvl=info msg="Error authorizing query" log_id=0Yt87tw0000 service=httpd error="create admin user first or disable authentication"
Jan 06 18:52:24 openhabian influxd-systemd-start.sh[861]: [httpd] 127.0.0.1 - openhab [06/Jan/2022:18:52:24 +0100] "GET /query?db=dieKucharsOH&epoch=ms&q=SELECT+%22value%22%3A%3Afield%2C%22item%22%3A%3Atag+FROM+autogen.RaspberryPiSystemMonitoring_RemainingTime+ORDER+BY+time+DESC+LIMIT+1%3B HTTP/1.1" 403 87 "-">
Jan 06 18:52:24 openhabian influxd-systemd-start.sh[861]: ts=2022-01-06T17:52:24.933985Z lvl=info msg="Error authorizing query" log_id=0Yt87tw0000 service=httpd error="create admin user first or disable authentication"
php
runtimeInfo:
  version: 3.2.0
  buildString: Release Build
locale: de-AT
systemInfo:
  configFolder: /etc/openhab
  userdataFolder: /var/lib/openhab
  logFolder: /var/log/openhab
  javaVersion: 11.0.13
  javaVendor: Azul Systems, Inc.
  javaVendorVersion: Zulu11.52+13-CA
  osName: Linux
  osVersion: 5.10.63-v7l+
  osArchitecture: arm
  availableProcessors: 4
  freeMemory: 110553136
  totalMemory: 194772992
bindings:
  - coronastats
  - fronius
  - hue
  - netatmo
  - network
  - systeminfo
clientInfo:
  device:
    ios: false
    android: false
    androidChrome: false
    desktop: true
    iphone: false
    ipod: false
    ipad: false
    edge: false
    ie: false
    firefox: false
    macos: true
    windows: false
    cordova: false
    phonegap: false
    electron: false
    nwjs: false
    webView: false
    webview: false
    standalone: false
    os: macos
    pixelRatio: 2
    prefersColorScheme: light
  isSecureContext: false
  locationbarVisible: true
  menubarVisible: true
  navigator:
    cookieEnabled: true
    deviceMemory: N/A
    hardwareConcurrency: N/A
    language: de-DE
    languages:
      - de-DE
    onLine: true
    platform: MacIntel
  screen:
    width: 2560
    height: 1440
    colorDepth: 24
  support:
    touch: false
    pointerEvents: true
    observer: true
    passiveListener: true
    gestures: false
    intersectionObserver: true
  themeOptions:
    dark: light
    filled: true
    pageTransitionAnimation: default
    bars: filled
    homeNavbar: default
    homeBackground: default
    expandableCardAnimation: default
  userAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15
    (KHTML, like Gecko) Version/15.1 Safari/605.1.15
timestamp: 2022-01-06T18:30:50.040Z

As far as I understand your description you changed the admin username in Grafana ( which is the client ).
You need to use the same username/password also in the server part which is influxdb that is accessed by the client.

Can you please help me on how I do that? in the ./etc/influxdb/influxdb.conf file I cannot find a username and password setting


I found the correct config file, it is lying at ./etc/openhab/services/influxdb.cfg. However the problem persists, log files now look different tough
it says create admin user first
but how?

I actually realised that there is a setting in the Openhab web UI where the user is also administered (see screenshot). I have the same settings there as well. BTW, when I change this setting it is NOT going to get written into the ./etc/openhab/services/influxdb.cfg. Should not this not be the server-side setting?

Openhab Log stream:

2022-01-06 20:36:37.085 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Time zone set to 'Europe/Vienna'.
2022-01-06 20:36:37.120 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Location set to '48.307193812638864,16.565958559513096'.
2022-01-06 20:36:37.122 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Locale set to 'de_AT'.
2022-01-06 20:36:43.588 [WARN ] [org.openhab.core.net.NetUtil        ] - Could not find broadcast address of primary IP, using broadcast address null of first interface instead
2022-01-06 20:36:50.093 [INFO ] [.core.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007
2022-01-06 20:36:53.383 [INFO ] [org.openhab.ui.internal.UIService   ] - Started UI on port 8080
2022-01-06 20:36:56.766 [INFO ] [ab.ui.habpanel.internal.HABPanelTile] - Started HABPanel at /habpanel
2022-01-06 20:36:57.453 [INFO ] [e.automation.internal.RuleEngineImpl] - Rule engine started.
2022-01-06 20:36:59.220 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'QueryablePersistenceService.query()' on 'org.openhab.persistence.influxdb.InfluxDBPersistenceService@1f1f299': error authorizing query: create admin user first or disable authentication
org.influxdb.InfluxDBException: error authorizing query: create admin user first or disable authentication

the journal looks pretty much the same:

 -- Journal begins at Wed 2022-01-05 15:45:02 CET, ends at Thu 2022-01-06 20:47:51 CET. --

Jan 06 20:36:11 openhabian systemd[1]: Starting InfluxDB is an open-source, distributed, time series database...

Jan 06 20:36:17 openhabian influxd-systemd-start.sh[862]: Merging with configuration at: /etc/influxdb/influxdb.conf

Jan 06 20:36:17 openhabian influxd-systemd-start.sh[859]: ts=2022-01-06T19:36:17.917287Z lvl=info msg="InfluxDB starting" log_id=0YtE6v~G000 version=1.8.10 branch=1.8 commit=688e697c51fd

Jan 06 20:36:17 openhabian influxd-systemd-start.sh[859]: ts=2022-01-06T19:36:17.917359Z lvl=info msg="Go runtime" log_id=0YtE6v~G000 version=go1.13.8 maxprocs=4

Jan 06 20:36:18 openhabian influxd-systemd-start.sh[994]: Merging with configuration at: /etc/influxdb/influxdb.conf

Jan 06 20:36:18 openhabian influxd-systemd-start.sh[859]: ts=2022-01-06T19:36:18.123688Z lvl=info msg="Using data dir" log_id=0YtE6v~G000 service=store path=/var/lib/influxdb/data

Jan 06 20:36:18 openhabian influxd-systemd-start.sh[859]: ts=2022-01-06T19:36:18.124045Z lvl=info msg="Compaction settings" log_id=0YtE6v~G000 service=store max_concurrent_compactions=2 throughput_bytes_per_second=50331648 throughput_bytes_per_second_burst=50331648

Jan 06 20:36:18 openhabian influxd-systemd-start.sh[859]: ts=2022-01-06T19:36:18.124111Z lvl=info msg="Open store (start)" log_id=0YtE6v~G000 service=store trace_id=0YtE6wo0000 op_name=tsdb_open op_event=start

Jan 06 20:36:18 openhabian influxd-systemd-start.sh[859]: ts=2022-01-06T19:36:18.124236Z lvl=info msg="Open store (end)" log_id=0YtE6v~G000 service=store trace_id=0YtE6wo0000 op_name=tsdb_open op_event=end op_elapsed=0.129ms

Jan 06 20:36:18 openhabian influxd-systemd-start.sh[859]: ts=2022-01-06T19:36:18.162712Z lvl=info msg="Opened service" log_id=0YtE6v~G000 service=subscriber

Jan 06 20:36:18 openhabian influxd-systemd-start.sh[859]: ts=2022-01-06T19:36:18.162777Z lvl=info msg="Starting monitor service" log_id=0YtE6v~G000 service=monitor

Jan 06 20:36:18 openhabian influxd-systemd-start.sh[859]: ts=2022-01-06T19:36:18.162798Z lvl=info msg="Registered diagnostics client" log_id=0YtE6v~G000 service=monitor name=build

Jan 06 20:36:18 openhabian influxd-systemd-start.sh[859]: ts=2022-01-06T19:36:18.162815Z lvl=info msg="Registered diagnostics client" log_id=0YtE6v~G000 service=monitor name=runtime

Jan 06 20:36:18 openhabian influxd-systemd-start.sh[859]: ts=2022-01-06T19:36:18.162830Z lvl=info msg="Registered diagnostics client" log_id=0YtE6v~G000 service=monitor name=network

Jan 06 20:36:18 openhabian influxd-systemd-start.sh[859]: ts=2022-01-06T19:36:18.162853Z lvl=info msg="Registered diagnostics client" log_id=0YtE6v~G000 service=monitor name=system

Jan 06 20:36:18 openhabian influxd-systemd-start.sh[859]: ts=2022-01-06T19:36:18.162884Z lvl=info msg="Starting precreation service" log_id=0YtE6v~G000 service=shard-precreation check_interval=10m advance_period=30m

Jan 06 20:36:18 openhabian influxd-systemd-start.sh[859]: ts=2022-01-06T19:36:18.190002Z lvl=info msg="Starting snapshot service" log_id=0YtE6v~G000 service=snapshot

Jan 06 20:36:18 openhabian influxd-systemd-start.sh[859]: ts=2022-01-06T19:36:18.224870Z lvl=info msg="Starting continuous query service" log_id=0YtE6v~G000 service=continuous_querier

Jan 06 20:36:18 openhabian influxd-systemd-start.sh[859]: ts=2022-01-06T19:36:18.251422Z lvl=info msg="Starting HTTP service" log_id=0YtE6v~G000 service=httpd authentication=true

Jan 06 20:36:18 openhabian influxd-systemd-start.sh[859]: ts=2022-01-06T19:36:18.251593Z lvl=info msg="opened HTTP access log" log_id=0YtE6v~G000 service=httpd path=stderr

Jan 06 20:36:18 openhabian influxd-systemd-start.sh[859]: ts=2022-01-06T19:36:18.251621Z lvl=info msg="Auth is enabled but shared-secret is blank. BearerAuthentication is disabled." log_id=0YtE6v~G000 service=httpd

Jan 06 20:36:18 openhabian influxd-systemd-start.sh[856]: InfluxDB API unavailable after 1 attempts...

Jan 06 20:36:18 openhabian influxd-systemd-start.sh[859]: ts=2022-01-06T19:36:18.573369Z lvl=info msg="Listening on HTTP" log_id=0YtE6v~G000 service=httpd addr=127.0.0.1:8086 https=false

Jan 06 20:36:18 openhabian influxd-systemd-start.sh[859]: ts=2022-01-06T19:36:18.573460Z lvl=info msg="Starting retention policy enforcement service" log_id=0YtE6v~G000 service=retention check_interval=30m

Jan 06 20:36:18 openhabian influxd-systemd-start.sh[859]: ts=2022-01-06T19:36:18.573806Z lvl=info msg="Listening for signals" log_id=0YtE6v~G000

Jan 06 20:36:18 openhabian influxd-systemd-start.sh[859]: ts=2022-01-06T19:36:18.573786Z lvl=info msg="Sending usage statistics to usage.influxdata.com" log_id=0YtE6v~G000

Jan 06 20:36:19 openhabian influxd-systemd-start.sh[859]: [httpd] 127.0.0.1 - - [06/Jan/2022:20:36:19 +0100] "GET /health HTTP/1.1" 200 107 "-" "curl/7.74.0" ebfddf01-6f27-11ec-8001-e45f01610c46 38105

Jan 06 20:36:19 openhabian influxd-systemd-start.sh[856]: InfluxDB started

Jan 06 20:36:19 openhabian systemd[1]: Started InfluxDB is an open-source, distributed, time series database.

Jan 06 20:36:59 openhabian influxd-systemd-start.sh[859]: [httpd] 127.0.0.1 - AlexollonAdmin [06/Jan/2022:20:36:59 +0100] "GET /ping HTTP/1.1" 204 0 "-" "okhttp/3.14.9" 038f5f6a-6f28-11ec-8002-e45f01610c46 63

Jan 06 20:36:59 openhabian influxd-systemd-start.sh[859]: ts=2022-01-06T19:36:59.209731Z lvl=info msg="Error authorizing query" log_id=0YtE6v~G000 service=httpd error="create admin user first or disable authentication"

That as far as I understand is the user that accesses the influxdb.

The user defined in the web UI resp. influxdb.cfg file is the user that will be used as admin user to create the influxdb and also to access the database and store values.

Did you just rename it in Grafana or also in the openhab configuration ?
At what time ? Assumed that you initially used user_a and changed it to user_b later but the influxdb already was created it seem to contain user_a.
Do a sudo

strings /var/lib/influxdb/meta/meta.db

Among other entries that should show the list of users that once were created.

You may have two options ( choose either 1 or 2 ) to try:

  1. a) reinstall influxdb
    b) reconfigure influxdb ( created db and create (admin) user, grafana user )
  2. a) change the influxdb configuration to not use authentication;
    b) restart influxdb service
    c) then use influx client to access the influxdb ;
    d) examine the users that are stored in the db;
    e) change the users settings like remove obsolete user;
    f) add an admin account;
    g) add the related passsword;
    h) enable authentication again

Thx Wolfgang for your help!

actually this meta.db file does not hold any relevant information. it is only 20 bytes long.

openhabian@openhabian:~ $ sudo strings /var/lib/influxdb/meta/meta.db
openhabian@openhabian:~ $ la strings /var/lib/influxdb/meta/meta.db
ls: cannot access 'strings': No such file or directory
-rw-r--r-- 1 influxdb influxdb 20 Jan  6 21:20 /var/lib/influxdb/meta/meta.db
openhabian@openhabian:~ $ 

to your proposals how to solve the issue - first of all a BIG THANK YOU for your efforts!
ad 1) that would mean I would loose the data collected so far and the grafana dashboard I created. not a big drama, but not what I really want.
ad 2) sounds like a logical way. however, I dont know how to do that exactly.

I played a little bit around: the file

./etc/openhab/services/influxdb.cfg

data is shown in the UI (see screenshot). However, what does not work is to edit the settings there - actually you can do that in the UI but the data is not written to the config file (also not after restart of openhab an edited change is accepted).

Actually there are 3 users:
.) the InfluxDB admin user to setup the DB,etc
.) the Openhab user that accesses the influxDB = that is the one in the UI shown and from this one we know where it is stored (./etc/openhab/services/influxdb.cfg)
.) the Grafana user that accesses the influxDB
For the first and last I dont know where to find them.
I also dont know which one is actually causing the problem, I was thinking of the second one. There is no other config file in the same directory. I searched several locations for Grafana, like

/etc/grafana/provisioning

but no config file found that holds the authentication data for Grafana
but that is anyway a second order problem, first InfluxDB has to work with Openhab again


There is a script here written by Christoph Wempe that I’ve used in the past to migrate data from a 2.4 system into InfluxDB. I’ve not tested it in a 3.2 system but thought it could possibly be useful.

1 Like

Let’s do one step back. I think there is some information missing to fully understand the probelm.
a) is this a fresh OH3 instance ?
b) was it migrated from OH2 ?
c) were does the existing data come from ?
d) you started to collect data but in between you changed the admin account configuration in Grafana ?

Hi Wolfgang,

to your q:
a) yes, fresh instance.
b) no data migrated. and yes, I can reinstall influxdb if needed, but I would rather want to understand the problem better before I do that.
c) I dont know exactly what you mean with “existing data”? if you mean sensor data: it comes from HUE bridge with some motion sensors as well as from Netatmo devices. This works all fine. I can see the devices online and showing instant values. what does not work is showing historic data - but obviously as the writing to the influxDB does not work (and persistence is set to influxDB).
d) actually I thought everything is fine when I did the initial configuration. I am a little bit a “strict follower of my own rules” and I made a “mistake” when I installed the influxDB that I wanted to correct “in operation in the Grafana web app”. That was the only change I did after the installation when everything was working perfectly and the first restart of the Raspi when Grafana/InfluxDB stopped working. Obviously a very stupid mistake. But nevertheless, I would want to understand what is wrong and how to correct it without reinstalling influxDB/Grafana.

Sure, that’s the way how learning works.
From that what I understand my conclusion would be that the admin user never has been created.
Let’s try to check:

  • turn off authentication in /etc/influxdb/influxdb.conf ( for individual steps see Change InfluxDB password user )
  • connect to the influx instance: influx
  • enter: show users
  • enter: show databases

The output then will show the list of users vs. admins and databases.
What is the output of the above commands ?

If no admin is being shown you need to create one.
Also make sure that you have a user for openhab and for grafana.

Here we go:

openhabian@openhabian:/etc/influxdb $ cat influxdb.conf | grep -v "#" | grep -v "^$"
[meta]
  dir = "/var/lib/influxdb/meta"
[data]
  dir = "/var/lib/influxdb/data"
  wal-dir = "/var/lib/influxdb/wal"
  series-id-set-cache-size = 100
[coordinator]
[retention]
[shard-precreation]
[monitor]
  store-enabled = false
[http]
  enabled = true
  bind-address = "localhost:8086"
  auth-enabled = false
[logging]
[subscriber]
[[graphite]]
[[collectd]]
[[opentsdb]]
[[udp]]
[continuous_queries]
[tls]
openhabian@openhabian:/etc/influxdb $ service influxdb start
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start 'influxdb.service'.
Authenticating as: ,,, (openhabian)
Password: 
==== AUTHENTICATION COMPLETE ===
openhabian@openhabian:/etc/influxdb $ show user
-bash: show: command not found
openhabian@openhabian:/etc/influxdb $ show users
-bash: show: command not found
openhabian@openhabian:/etc/influxdb $ influx
Connected to http://localhost:8086 version 1.8.10
InfluxDB shell version: 1.8.10
> show users
ERR: error authorizing query: create admin user first or disable authentication
Warning: It is possible this error is due to not setting a database.
Please set a database with the command "use <database>".
> show databases
ERR: error authorizing query: create admin user first or disable authentication
Warning: It is possible this error is due to not setting a database.
Please set a database with the command "use <database>".
> 

Actually I did not stop the influxDB before I did “show user”. I repeated now with stopping influx first. outcome is the following:

openhabian@openhabian:/etc/influxdb $ service influxdb stop
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to stop 'influxdb.service'.
Authenticating as: ,,, (openhabian)
Password: 
==== AUTHENTICATION COMPLETE ===
openhabian@openhabian:/etc/influxdb $ service influxdb start
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start 'influxdb.service'.
Authenticating as: ,,, (openhabian)
Password: 
==== AUTHENTICATION COMPLETE ===
openhabian@openhabian:/etc/influxdb $ influx
Connected to http://localhost:8086 version 1.8.10
InfluxDB shell version: 1.8.10
> show users
user admin
---- -----