How to best debug HABPanel Grafana issues?

Hi there,

I’m struggling to get Grafana in a HABPanel frame working.
Everything done like described in the according example documentation, but the frame just stays empty.

Now, I’m looking for a way to debug this.
Has anyone a good idea?

  • Grafana and OpenHAB working on the same server
  • both on latest levels
  • I have integrated MySQL as data source without any issue
  • Grafana dashboard and panel created
  • anonymous user access for Grafana is working

Thanks for any hints & tips!

2 Likes

Hi!

Where did you get the URL for your graph from? Did you use share->embed in grafana and copy the URL?
Maybe you could post your HabPanel frame configuration, that’d help for sure!

all the best

Bob

So, I use the standard frame widget of HABPanel.

The URL is taken from the the Grafana, the embeeded link of the actual graph, not the dashboard.

<iframe src="http://zotac:3000/d-solo/0ZnG09uZk/openhab?orgId=2&from=1584680013518&to=1584701613519&panelId=2" width="450" height="200" frameborder="0"></iframe>

Of course, the widget likes URL only, so I stripped it down to,

http://zotac:3000/d-solo/0ZnG09uZk/openhab?orgId=2&from=1584613169781&to=1584634769782&panelId=2

Hi,

can you try and replace the host name “zotac” with the IP address of your machine?
Additionally, you don’t need an refresh interval for grafana widgets, you can set the refresh period in the dashboard settings in grafana, preventing ugly frame reloads in your HabPanel.
The from= and to= timestamps should also be replaced with something more senseful, like:
from=now-7d&to=now

Just to be sure, in addition to what @BobMiles mentioned, did you also check what your browser shows when just opening the URL?

So, I did replace the hostname with the IP address - nothing changed.
I changed the interval as suggested. The Grafana link itself produces proper graph - the widget showed nothing.
Also, I opened the Grafana graph from the system hosting my openHAB, and it showed a proper graph, as well as my office desktop does. And the frame widget does not show anything on the actual host either.

On what machine do you open the HabPanel? Could there be some issue with your Browser?

Dit you try to remove the frame widget and add it again?

I did test on the actual hosting server directly, but also on a client. Both do not work. Removing and adding the frame does not fix it.
I would be interested, if HABpanel indeed reaching out to the Grafana panel. So, i just wonder if there is a way to track this down without huge network tracing?

One step further, I found two settings required in the grafana.ini to have the Grafana

<iframe>

working in a HTML file with the embedded link as described in the Grafana tutorial.

allow_embedding: true
cookie_samesite: none

I created a simple test side, which displays the container correctly. :+1:
The HABpanel is still blank. :frowning_face:

FIXED!! :slight_smile:

You need to consider a couple of items.

  1. Check the grafana.ini regarding the settings, I posted earlier already:
allow_embedding: true
cookie_samesite: none
  1. If HABpanel runs on HTTPS protocol, needs to run it also. Otherwise, modern browsers are blocking non-secure content. And this is what happened in my case.

  2. Everything else works as described in the tuturial. :+1:

Only item left here, to get it running on iOS devices. Since this has something to do with the different SSL certifcates of HABpanel and Grafana … tbc.