InfluxDB+Grafana persistence and graphing

so… either change the port on the bridge or change the default port of Grafana… :slight_smile:

I trying MQTT but hoping I don’t stuff it up. Can’t find out how to do it with Grafana :frowning: that why I trying with MQTT 1st

Fixed :smiley:

Summary

obama

thanks will check before asking sorry for posting but lol getting close to finshed in :smiley:

Is @ThomDietrich saying I can skip

Because I did and now in data Source when adding openhab_db I get


InfluxDB Error: error authorizing query: create admin user first or disable authentication

Ok fixed if you

auth-enabled = false         # will enforce authentication

If anyone as “not smart” like me

Hi! If anyone is in the need of processing large amounts of data from OH1 rrd to OH2 influx maybe can be interested in this: rrdToInflux
I was in the need today and just dodged some manual work with this
HTH

Has anyone problem with the recent update of android OpenHAB application?
Grafana in WebView returns error (after tap on exclamation mark):

Invalid dimensions for plot, width = 384, height = 0

In previous OpenHAB android app I saw grafana chart without problems.

https://community.openhab.org/search?q=grafana%20category%3A18

1 Like

Hello,

I followed this nice tutorial to set up Influxdb and Grafana, but I get stuck while adding a datasource:

Openhab can write to the InfluxDB, according the service status:

● influxdb.service - InfluxDB is an open-source, distributed, time series database
   Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2018-11-19 22:59:38 CET; 10min ago
     Docs: https://docs.influxdata.com/influxdb/
 Main PID: 406 (influxd)
   CGroup: /system.slice/influxdb.service
           └─406 /usr/bin/influxd -config /etc/influxdb/influxdb.conf

Nov 19 23:05:24 openHABianPi influxd[406]: [httpd] 127.0.0.1 - openhab [19/Nov/2018:23:05:24 +0100] "POST /write?consistency=one&db=openhab_db&p=%5BREDACTED%5D&precision=n&rp=autogen&u=openhab HTTP/1.1" 204 0 "-" "okhttp/2.4.0" 36e449b3$
Nov 19 23:05:54 openHABianPi influxd[406]: [httpd] 127.0.0.1 - openhab [19/Nov/2018:23:05:54 +0100] "POST /write?consistency=one&db=openhab_db&p=%5BREDACTED%5D&precision=n&rp=autogen&u=openhab HTTP/1.1" 204 0 "-" "okhttp/2.4.0" 48b70f43$
Nov 19 23:06:24 openHABianPi influxd[406]: [httpd] 127.0.0.1 - openhab [19/Nov/2018:23:06:24 +0100] "POST /write?consistency=one&db=openhab_db&p=%5BREDACTED%5D&precision=n&rp=autogen&u=openhab HTTP/1.1" 204 0 "-" "okhttp/2.4.0" 5a98c234$
Nov 19 23:06:54 openHABianPi influxd[406]: [httpd] 127.0.0.1 - openhab [19/Nov/2018:23:06:54 +0100] "POST /write?consistency=one&db=openhab_db&p=%5BREDACTED%5D&precision=n&rp=autogen&u=openhab HTTP/1.1" 204 0 "-" "okhttp/2.4.0" 6c7a5eb2$
Nov 19 23:07:24 openHABianPi influxd[406]: [httpd] 127.0.0.1 - openhab [19/Nov/2018:23:07:24 +0100] "POST /write?consistency=one&db=openhab_db&p=%5BREDACTED%5D&precision=n&rp=autogen&u=openhab HTTP/1.1" 204 0 "-" "okhttp/2.4.0" 7e5b8809$
Nov 19 23:07:54 openHABianPi influxd[406]: [httpd] 127.0.0.1 - openhab [19/Nov/2018:23:07:54 +0100] "POST /write?consistency=one&db=openhab_db&p=%5BREDACTED%5D&precision=n&rp=autogen&u=openhab HTTP/1.1" 204 0 "-" "okhttp/2.4.0" 903d9099$
Nov 19 23:08:24 openHABianPi influxd[406]: [httpd] 127.0.0.1 - openhab [19/Nov/2018:23:08:24 +0100] "POST /write?consistency=one&db=openhab_db&p=%5BREDACTED%5D&precision=n&rp=autogen&u=openhab HTTP/1.1" 204 0 "-" "okhttp/2.4.0" a21f3831$
Nov 19 23:08:54 openHABianPi influxd[406]: [httpd] 127.0.0.1 - openhab [19/Nov/2018:23:08:54 +0100] "POST /write?consistency=one&db=openhab_db&p=%5BREDACTED%5D&precision=n&rp=autogen&u=openhab HTTP/1.1" 204 0 "-" "okhttp/2.4.0" b400dafa$
Nov 19 23:09:24 openHABianPi influxd[406]: [httpd] 127.0.0.1 - openhab [19/Nov/2018:23:09:24 +0100] "POST /write?consistency=one&db=openhab_db&p=%5BREDACTED%5D&precision=n&rp=autogen&u=openhab HTTP/1.1" 204 0 "-" "okhttp/2.4.0" c5e28e36$
Nov 19 23:09:54 openHABianPi influxd[406]: [httpd] 127.0.0.1 - openhab [19/Nov/2018:23:09:54 +0100] "POST /write?consistency=one&db=openhab_db&p=%5BREDACTED%5D&precision=n&rp=autogen&u=openhab HTTP/1.1" 204 0 "-" "okhttp/2.4.0" d7c42e49$

Excerpt from

/etc/influxdb/influxdb.conf

[http]
  # Determines whether HTTP endpoint is enabled.
   enabled = true

  # Determines whether the Flux query endpoint is enabled.
  # flux-enabled = false

  # The bind address used by the HTTP service.
   bind-address = ":8086"

  # Determines whether user authentication is enabled over HTTP/HTTPS.
   auth-enabled = true


My influxdb.cfg:

# The database URL, e.g. http://127.0.0.1:8086 or https://127.0.0.1:8084 .
# Defaults to: http://127.0.0.1:8086
url=http://127.0.0.1:8086

# The name of the database user, e.g. openhab.
# Defaults to: openhab
user=openhab

# The password of the database user.
password=supersecret

# The name of the database, e.g. openhab.
# Defaults to: openhab
db=openhab_db

# The retention policy to be used, needs to configured in InfluxDB
# Till v0.13: 'default', since v1.0: 'autogen'
retentionPolicy=autogen

Any idea why Grafana is not able to connect to the DB?

change the Data Source type from Graphite to InfluxDB :slight_smile:

2 Likes

@Dim

Shame on me, the only setting I did not transfer carefully.

I remember one of my profs saying “90% of all problems can be solved by looking carefully!”

He was right, thank you!

1 Like

Try this in grafana.ini

[auth.basic]
enabled = false

Hi thread.
I have made an effort of automate the initial installation and configuration for InfluxDB + Grafana within the scope of the openhabian project. If you have some spare time please help me test it out before I merge it.

Have a missed some essential feature/configuration that every user need to do?

3 Likes

This is great! How exactly might one go about testing this?

Is there a git command that can be used to fetch this particular commit into existing directory (/opt/openhabian/functions) of an existing openhabian setup?

followed by running the openhabian-config wizard?

If so, I could potentially give this a whirl on a fresh installation of a Raspberry Pi3B and report back.

… 2 days later…


Right or wrong, I manually merged your updated code to the 2 files (openhab.sh and packages.sh) in the folder /opt/openhabian/functions of my new install which seemed to do the trick!. Then I ran the command

$ sudo openhabian-config

I chose the option to install influxdba+grafana. and i believe it was running using this updated code. However, line 419 should be updated as the message still includes the text “Soon this procedure will also set up the connection between them and with openHAB.” which was misleading…

Anyway, here is the error I received on my raspberryPi 3B. It looks like the wrong package architecture was downloaded.

I corrected manually by downloading the following file:

wget https://dl.grafana.com/oss/release/grafana_5.4.0_armhf.deb 
sudo dpkg -i grafana_5.4.0_armhf.deb 

Here is the error I received.

$ dpkg -i grafana_5.3.4_arm64.deb 
dpkg: error processing archive grafana_5.3.4_arm64.deb (--install):
 package architecture (arm64) does not match system (armhf)
Errors were encountered while processing:
 grafana_5.3.4_arm64.deb

$ systemctl daemon-reload 

$ systemctl enable grafana-server.service 
Failed to enable unit: File grafana-server.service: No such file or directory

Thanks for testing out!
Looks like I didn’t really got the installation correct with Grafana.
I will look into it!

Thanks! Again, great work.

I look forward to seeing this in the latest openhabian build soon! It will be helpful to many.

Sorry if this is the wrong place to post, let me know and i will change accordingly.

I am having a hell of a time finding this answer. I’v been searching for days and came up short. How do I display my Switch status ( ON/OFF ) on a Graph? I want to compare certain Sonoff’s ON and OFF states compared to when I am Home/Away . Also, How would you display a string ( Home/Away)? Is there a way where you can assign ON=1 and Away=0 in the metrics area? Sorry if this is a NOOB question I am very new to Grafana and Influx.

Thanks!

I’m not using influx so I can’t answer the second part of your question. For MySQL you can have a mapping in the query. Not sure if this is also possible with influx.

But for the first part (how to display concrete values) I can recommend the “discrete” widget.

Follow the installation instructions as this plugin is not part of the standard installation.

Greetings
Sebastian

1 Like