InfluxDB+Grafana persistence and graphing

I have some trouble with the installation of influxdb+grafana.

I see this line sin the openhab-log:

2019-11-12 10:20:35.475 [ERROR] [org.influxdb.impl.BatchProcessor ] - Batch could not be sent. Data will be lost
java.lang.RuntimeException: {“error”:“authorization failed”}
at org.influxdb.impl.InfluxDBErrorHandler.handleError(InfluxDBErrorHandler.java:19) ~[influxdb-java-2.2.jar:?]
at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:242) ~[retrofit-1.9.0.jar:?]
at org.influxdb.impl.$Proxy134.writePoints(Unknown Source) ~[?:?]
at org.influxdb.impl.InfluxDBImpl.write(InfluxDBImpl.java:151) ~[influxdb-java-2.2.jar:?]
at org.influxdb.impl.BatchProcessor.write(BatchProcessor.java:171) [influxdb-java-2.2.jar:?]
at org.influxdb.impl.BatchProcessor$1.run(BatchProcessor.java:144) [influxdb-java-2.2.jar:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_222]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_222]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_222]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_222]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_222]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_222]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]

What is the problem and how can i solve this?

BR Rene

I’m pretty sure that is the problem. Check your credentials or remove them all together.

Okay, but what is the problem?
I tried to see the influxdb and started “influx” in a putty-session. But i get only the same error for all inputs i do. For example, i will see all databases with “show databases” and it show this error:

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

show databases
ERR: unable to parse authentication credentials
Warning: It is possible this error is due to not setting a database.
Please set a database with the command “use ”.

:edit: I got it running, i connected with the worng user. After i connect with correct user i could create the database und now ist running.

I have a problem with influxdb i can not make a database or a user it always say’s

ERR: error authorizing query: no user provided
Warning: It is possible this error is due to not setting a database.
Please set a database with the command "use <database>".

I searched the forum but cant find a working solution?
Anyone have an idea what could be wrong?

It is working i did a fresh installation of influxdb and did the following

sudo service influxdb stop

Enable authentication in the [http] section of the configuration file /etc/influxdb/influxdb.conf :

[http]  
enabled = true  
bind-address = ":8086"      # change to a specific interface if needed 
auth-enabled = false         # will enforce authentication

and restarted influx

sudo service influxdb start

Hi everyone,

I am struggling with the webview of the charts. In my basicUI they are shown with a lot of space due to the height indicator:

Webview url="/static/Grafana-graph/chartsHour.html" height=20 visibility=[TemperaturenChart=="0"]

Now I am having different Devices. The height of 20 e.g. is fitting perfect by tablet. How can I use a “auto” sizing for different devices like mobile phone or browser without creating different sitemaps? The app is adjusting the “standard” chart item graphs without any problems (each device is putting correct chart in), but not the Webview items. Can someone tell me if this is possible to have an auto height based on the device?

Grafana with wrong fix height:

Bildschirmfoto 2019-11-25 um 18.35.24

standard example graph with correct indicator:

Would be nice if someone can help me. height=auto is not fitting. :wink:

Thank you,

Woogi

I’ve been trying for 3 days now to setup InfluxDB, tried everything I read in several posts, but still I get the ERR=authorization failed in the Influx CLI.
Also chris669 suggestions didn’t work.
Don’t know what to try next… think I already re-installed 4 times the InfluxDB+Grafana via sudo openhabian-config. Carefully noted all users and passwords, tried different users and passwords in the “influx -port 8086 -username …” command and all to no avail :sleepy:

I’d create one sitemap per device type, e.g.:

  • home-tablet.sitemap for tablets etc.
  • home-smartphone.sitemap for smartphones (smaller display)

This way you can create different visualisations depending on the device (and the available screen real estate).

Hi, just joined that conversation. Have you ever tried to install via APT?

KR

Chris,

No haven’t tried. Think it can work ?

@shutterfreak thank you for your quick reply. That was what I was feared of. I want to avoid creating different sitemaps. I have one wall mounted tablet I use with habPanel. The other devices I would like to feed with one sitemap using autoscale as it is for standard charts.

If there is no solution I will continue using standard charts for the App and Grafana for the wall mounted habPanel solution.

Thx.

Hi, yes - of course. I always try to avoid pre-defined installations as in most cases you’ll get older packages that (only) work in a specific configuration.

InfluxDB:
https://docs.influxdata.com/influxdb/v1.7/introduction/installation/

In case you’re running Debian Buster / planning to run Debian Buster, there’s of course also a Buster repo @ https://repos.influxdata.com/debian/dists/buster/, just modify the entry in influxdb.list.

After install, proceed to https://docs.influxdata.com/influxdb/v1.7/introduction/getting-started/.

Everything you need to know abouth AUTH is well documented @ https://docs.influxdata.com/influxdb/v1.7/administration/authentication_and_authorization/.

If you’re interested in a lightweight data-browser, you can try https://docs.influxdata.com/chronograf/v1.7/ - Chronograf is the “C” in “TICK”-stack.

Grafana:
In case you want to visualize your data here’s the link to Grafana documentation - https://grafana.com/docs/installation/debian/.

Let me know if that helps!

I’m running now the third openHAB / InfluxDB / Grafana installation and it works like a charm.

Im at a loss here, i have this “authorization failed” error as well.
Im running openhab etc on a laptop running ubuntu 18 (so not the most used raspi3), installed influxdb &grafana using the script in the openhabian installer

trying your solution already stops me at the second line:
sudo chown openhab:openhabian /etc/openhab2/services/influxdb.cfg
gives error chown: invalid group: ‘openhab:openhabian’
user rights management is total rocket science for me with ubuntu.

any pointers to what i can try? how to find out the correct user/group combo?

If you are running on Ubuntu you probably are not running openHABian. It if you are, the manual installation instructions do not create an openhabian user. Use your login in place of openhabian on that command.

i managed to get it working:
first had to disable authentication in the influx config file. now i was able to create all users and database.

[http]
  enabled = true
  bind-address = ":8086"
  auth-enabled = false
  .....

so the error in the install script also does not create the users

I’ve run into the DB setup on a Pi4 as well. Turns out the setup script is not waiting long enough for influxdb to come up before trying to create the users.

The fix is simple, in /opt/openhabian/functions/influxdb+grafana.bash search for the lines:

    cond_redirect systemctl restart influxdb.service
    sleep 10

and replace the sleep 10 with a sleep 60.
There are two instances of this, make sure you edit both.

Especially since you’ve found a solution, a PR would be greatly appreciated.

There is a second problem, the test in https://github.com/openhab/openhabian/blob/master/functions/influxdb%2Bgrafana.bash#L153 is not satisfied when doing a local.

I’m expriencing an issue with non-working wildcards e.g “SpeedtestResult*” on items in influxdb.persist. Can anyone reproduce this issue?

* isn’t a wild card. From the docs:

<groupName>* - all members of this group will be persisted, but not the group itself. … Note that * is NOT a wildcard match character in this context.

1 Like