InfluxDB+Grafana persistence and graphing

Tags: #<Tag:0x00007f2fb5998e78> #<Tag:0x00007f2fb5998c70> #<Tag:0x00007f2fb5998a18>

Assuming you are using Debian or Ubuntu, the easiest method to upgrade Grafana is to use apt according to the instructions here:

i’m on openhabian (raspberry),

sudo apt-get install grafana

is not working there :frowning:

You followed all of the instructions on the link to add the key? Or just tried the install? You need to follow all of the instructions:

APT Repository

Create a file /etc/apt/sources.list.d/grafana.list and add the following to it.

deb stable main

There is a separate repository if you want beta releases.

deb beta main

Use the above line even if you are on Ubuntu or another Debian version. Then add our gpg key. This allows you to install signed packages.

curl | sudo apt-key add -

Update your Apt repositories and install Grafana

sudo apt-get update
sudo apt-get install grafana


does anyone have an idea why transparency doesn’t work, if a graph is used in HABpanel using an iframe? I don’t think that it is an issue of grafana since transparency works without problems, if the frame is opened directly. Is there any additional HABpanel or CSS setting necessary to make this work in HABpanel?


relevant html snippet:

<div class="section">
  <div class="bigDash">
    <div class="top">
      <div class="icon on"><svg viewBox="0 0 48 48"><use xlink:href="/static/matrix-theme/material-icons.svg#thermometer"></use></svg></div>
      <div class="value">
        <div class="main">{{(itemValue('Thermostat_Temperatur').split(' ')[0] | number:0)}}</div>
        <div class="decimals">,{{(itemValue('Thermostat_Temperatur').split(' ')[0] | number:1).split(',')[1]}}</div>
        <div class="sub">&#176C</div>
    <div class="bottom">
      <div class="icon off"><svg viewBox="0 0 48 48"><use xlink:href="/static/matrix-theme/material-icons.svg#trending-neutral"></use></svg></div>
      <div class="value">{{itemValue('Thermostat_Setpoint')}}</div>
    <div class="graph">
      <iframe src="https://<grafana-url>:3000/d-solo/000000003/habpanel?panelId=1&orgId=1&refresh=30s&tab=general&from=now-24h&to=now" width="90%" height="150" frameborder="0"></iframe>
      <div class="legend">Letzte 24h</div>


Any input greatly appriciated!


I write here because after searching and searching I have not found a solution to my problem. I followed the whole tutorial and I was able to install influxdb and grafana perfectly, I even have several graphs working on my sitemap with influxdb. My problem comes with grafana. I could only enter when I installed it and after that I could not do it anymore. I have reinstalled it several times without success. It appears in my openhab web panel but when I click it it does not connect me. The truth is that I have searched and tried many things before writing here. In the log I do not see any error regarding grafana. I do not know what else to do. It may be silly and I do not see it but I have run out of ideas.
My setup is:

Hardware: Raspberry PI 3B
OS: openHABian v1.4.1
Java Runtime Environment: openjdk version “1.8.0_152”
OpenJDK Runtime Environment (Zulu Embedded (build 1.8 .0_152-b76)
OpenJDK Client VM (Zulu Embedded (build 25.152-b76, m ixed mode, Evaluation)

Grafana’s version is the last.

If anyone could advise me, I would appreciate it. Thank you so much for everything. Regards:)

Hi @frifru, see my response in the other thread.

Not sure if this was picked up in the very long thread but though it might be useful to point out that, to insert a grafana panel into a sitemap, what I found worked was:

  1. Open the panel you have set up in the grafana dashboard e.g.
  2. Click on “share”:
  3. Click on “Direct link rendered image”.
  4. This should launch a new browser tab with the chart displayed again. Copy the url of the page.
  5. Insert a line into your sitemap as
Image refresh=60000 url="the url copied".

I think possibly you will need to edit the time frame in the url as described in the post.

Thank you so much for sharing this useful information.

Still the same problem, follow the instal procedure from Openhabian-config, follow all the steps and no hope!


I tried this procedure many times. I know the hard work to maintain this, but after reading almost all the posts, I’ve seen that we could avoid a part of this procedure by using the openhab-config option. But as I’m new on this, I still have problems to understand Right management, that means even after loggin to influx with sudo , without sudo, with all my hope, I get the following message when I try to do a basic function like SHOW DATABASES:

ERR: authorization failed
Warning: It is possible this error is due to not setting a database.
Please set a database with the command "use <database>".

So if the script that’s launch the installation of Grafana and InfluxDB is not fully complete, this that I can understand, what are the commands I need to lauch? I tried some, but still the same message with the wrong rights.

My grafana installation seems ok as I’m able to install Darksky plugin and play with graphs, I also installed the persistence, but when I try to connect from Grafana interface InfluxDB, no hope, as I even do not know if the db was correcty created. Using latest dev 2.5.x on RBIP3+
Thanks in advance.

OK, Reply to myself… After investigating through the forum, I’ve seen this post and now for those who encountered the same problem, beware, the script installing InfluxDB and Grafana doesn’t do all the job. DATABASE is not installed!
In my case, after a clean install, I had to proceed this way:

sudo chown -hR openhab:openhab /etc/openhab2
sudo chown openhab:openhabian /etc/openhab2/services/influxdb.cfg
influx -port 8086 -username myusername -password mypassword -host localhost

CREATE USER openhab WITH PASSWORD 'myopenhabpassword'
CREATE USER grafana WITH PASSWORD 'mygrafanapassword'
GRANT ALL ON openhab_db TO openhab
GRANT READ ON openhab_db TO grafana

@ThomDietrich I know it’s hard to maintain documentation, and I appreciate what has been done but it would be easy to copy these lines at the beginning of the topic, it would help Beginners like me. :upside_down_face:


Hi, I cant get this to work.

influx -port 8086 -username myusername -password mypassword -host localhost

is “myusername” and “mypassword” random becauce it still says “authorization failed”

this are the username and password values you choosed during db installation process.

Hi All .
This might be the wrong place to ask. but I have a problem .
when I open the graphs on my iPhone on the iOS app. it gives me a error and it does not show the graphs .just a whit screen and when I open it up on basic ui on myopenhab I just get a square with a question mark in it.

Does anyone else here got the same problem with the latest grafana version that you’re unable to display your graph anymore by pasting the embeded link into a frame.

It won’t show at all, seems that there are more people with this problem, did anyone here already found a solution:

I did for awhile but before I could investigate it started to work. I’d probably done a couple of upgrades after I first noticed the behavior so maybe an upgrade is needed. NOTE: I did not upgrade openHAB, was running 2.5 M1 the whole time.

The behavior I saw was that even when on my LAN, the graphs in BasicUI said that Grafana refused the connection. Pulling up the Grafana dashboard and pulling up the embedded link in a browser worked just fine.

I had the same problem, when investigating I found in /etc/grafana.ini an option:

# set to true if you want to allow browsers to render Grafana in a <frame>, <iframe>, <embed> or <object>. default is false.
allow_embedding = true

I uncommented this option and set it to “true”, after a grafana restart basicui showed the graphs again.
I think this is an older option but why it suddenly activated is beyond me…

It’s a new security “feature” introduced with Grafana 6.2.
The solution to this problem is quite easy.


Just in case someone else loses their embedded grafana panels following a grafana upgrade due to a “X-Frame-Options is set to false” error, I found a solution. It is the same solution outlined by @derkens with a twist. I had to actually add the “allow_embedding=true” statement to my /etc/grafana/grafana.ini config file under the file’s [security] section (i.e. it was not there to uncomment). See documentation for more info. If you add the statement to any section other than the [security] section it may not work. Of note, I’m using openhabian 2.4.0-1 w/ grafana 6.2.4 and influxdb

I can confirm that is correct. If you are running in Docker or configuring Grafana using environment variables instead of the config file, you would use GF_SECURITY_ALLOW_EMBEDDING=true.