Grafana charts via webview do not work

OH2.2
Grafana 4.6.3

Dear all

I need some help with the webview elements to get the Grafana charts displayed correctly.

What does not work:

  • opening Basic UI with https --> Grafana charts in webview are not displayed
    • neither in local network nor via remote access
  • opening Basic UI via myopenhab.org --> Grafana charts in webview are not displayed
  • opening Basic UI with http via remot access --> Grafana charts in webview are not displayed

What works:

  • opening Basic UI with http
    • in Chrome (local network)
    • in iOS App (local network)

I already did some research in this this thread but the proposed solution (thanks anyway to @wborn ) does not work (anymore?).

Any further hints what I can try?

Thanks & regards
John

I’m still using a HTTPS reverse proxy myself with with the Basic UI Webviews and Android App. That continues to work well with all latest greatest versions. Recently I added some details on how to configure this for my Grafana Javascript library.

Still not using myopenhab.org and iOS myself but the iOS App issue that I referred to remains open.

Hi,
I couldn’t get webview to work but the following works in my site map, graphs will show via web browser or IOS app.

My grafana/InfluxDB are on a separate Pi3 as well.

Frame  {
				Image item=System_Temperature_CPU
				url="http://192.168.1.176:3000/render/dashboard-solo/db/openhab-system?refresh=5m&orgId=1&panelId=6&from=now-1d&to=now&width=1000&height=320&tz=UTC%2B00%3A00"
				refresh=60000
				Image item=System_Temperature_CPU
				url="http://192.168.1.176:3000/render/dashboard-solo/db/openhab-system?refresh=5m&orgId=1&panelId=6&from=now-31d&to=now&width=1000&height=320&tz=UTC%2B00%3A00"
				refresh=60000
				Image item=System_Temperature_CPU
				url="http://192.168.1.176:3000/render/dashboard-solo/db/openhab-system?refresh=5m&orgId=1&panelId=6&from=now-183d&to=now&width=1000&height=320&tz=UTC%2B00%3A00"
				refresh=60000
				}

Might be worth a try

Last night I changed my sitemap so I had both a webview and static render of the same data, with IP address specified. Trying now with myopenhab and the android app, myopenhab shows only the static render, the android app shows neither, so the IP specification and statis render still doesn’t get you any closer in the app.

Hi,

I just configured openHAB app on my works Android 7.0 phone and the static image url’s still show up fine so I can see graphs in both IOS and Android.

There must be something else in your config that differs from mine.

In your Grafana configuration file do you have the following set:

[users]
allow_sign_up = false

[auth.anonymous]
enabled = true

[auth.basic]
enabled = false

I remember from some other posts that you need to make sure granafa is configured in a specific way for IOS to work which may be the same for Android.

Hi Kevin, I had mine set up as per the influxdb+grafana persistence tutorial, which only specifies the first two changes. I’ve just gone in and changed [auth.basic], which was commented out and set to enabled=true.
I thought that it worked, getting both static and webview showing up on my android tablet, but then I realised it was on the local network. Tried my android phone over the internet and still no go unfortunately, and via myopehab.org on a browser shows the static version.

Hi,

I will re-check my setup and see if I can figure out why I’m getting a different result based on the the static image url.

Kevin

Update: Just re-tested and Android is not working when on mobile data as I thought it was, works fine on wifi, I’m getting the following errors in the opehab log but not sure what they relate to at this time, too late to take a look tonight.

Another update: Again tested from Android and the static Image graphs do show thye are just very slow this is via data with wifi turned off so hitting remote url.
The same messages still appear when accessing via Android app but everything works at least for me.

io.openhabcloud.internal.CloudClient] - Jetty request 1171138 failed: null

Hi Kevin, I too just figured out that it’s taking a very long time to load but does get there eventually; accidentally found this when I left it open and went off to do something.
That said I just tried it multiple times, had a few timeouts then the odd quick load, so who knows

Hi,

Thats good news, in a way, as we are both seeing the same thing.
One thing to watch for is the number of open connections to your Grafana service can get get out of hand and flood the service if you refresh or try to open links on multiple devices, my Grafana/InfluxDB service is on another Pi3 and I have seen that machine grind to a halt because OH had over 65 established connections on port 3000 this caused the Pi to become un-responsive and only a hard reboot would fix the issue, no access via ssh when this happens, I now capture the number of connections on port 3000 and alert when they start to get to high.
Ive tried adding tcp parmeters to sysctl.conf and also disabled ipv6 connections but nothing thus far has stopped this from flooding the service.

Kevin

Hi,

Ok after having to yet again force a power off the grafana Pi3 because OH generated 60plus sessions for a few graphs I was trying to display I have now taken a different approach to displaying the graphs in OH.

I have created a comma delimited file which contains , I then have a small script which essentially reads the previous file and performs a wget of each graph and saves them in a gimages folder under /etc/openh2/html.
The wget script is cron’d to run ever 5 minutes, it takes around 200 seconds to run and generate 18 images.
I then changed all the static Image urls to point to the pre-pulled images in the gimage folder.

The graphs now load really quickly in OH web browser and work fine for the IOS and Android apps when accessing the local url.
Remote URL on IOS works, sometimes really quick and sometimes slow.
Remote URL on Android is still very much hit and miss but more miss than hit.

I still get the following errors for both IOS and Android while using remote URL.

2018-01-29 15:15:07.919 [WARN ] [io.openhabcloud.internal.CloudClient] - Jetty request 3100560 failed: null
2018-01-29 15:15:09.160 [WARN ] [io.openhabcloud.internal.CloudClient] - Jetty request 3101013 failed: null
2018-01-29 15:15:10.964 [WARN ] [io.openhabcloud.internal.CloudClient] - Jetty request 3101032 failed: null
2018-01-29 15:15:14.754 [WARN ] [io.openhabcloud.internal.CloudClient] - Jetty request 3101044 failed: null
2018-01-29 15:15:29.635 [WARN ] [io.openhabcloud.internal.CloudClient] - Jetty request 3101110 failed: null
2018-01-29 15:15:32.979 [WARN ] [io.openhabcloud.internal.CloudClient] - Jetty request 3101399 failed: null

Kevin

Well, honestly I don’t see the added value of this very complicated solution in comparison to the out of the box Image loader:

		Frame {
			Switch item=Lueftung_ChartSwitch01 mappings=[0="2h", 1="6h", 2="1d", 3="2d", 4="1w", 5="1M", 6="1y"]
				Image refresh=300000 url="http://192.168.0.13:3000/render/dashboard-solo/db/kwl?orgId=1&from=now-2h&to=now&panelId=1" visibility=[Lueftung_ChartSwitch01==0, Lueftung_ChartSwitch01==NULL]
				Image refresh=300000 url="http://192.168.0.13:3000/render/dashboard-solo/db/kwl?orgId=1&from=now-6h&to=now&panelId=1" visibility=[Lueftung_ChartSwitch01==1]
				Image refresh=300000 url="http://192.168.0.13:3000/render/dashboard-solo/db/kwl?orgId=1&from=now-1d&to=now&panelId=1" visibility=[Lueftung_ChartSwitch01==2]
				Image refresh=300000 url="http://192.168.0.13:3000/render/dashboard-solo/db/kwl?orgId=1&from=now-2d&to=now&panelId=1" visibility=[Lueftung_ChartSwitch01==3]
				Image refresh=300000 url="http://192.168.0.13:3000/render/dashboard-solo/db/kwl?orgId=1&from=now-1w&to=now&panelId=1" visibility=[Lueftung_ChartSwitch01==4]
				Image refresh=300000 url="http://192.168.0.13:3000/render/dashboard-solo/db/kwl?orgId=1&from=now-1M&to=now&panelId=1" visibility=[Lueftung_ChartSwitch01==5]
				Image refresh=300000 url="http://192.168.0.13:3000/render/dashboard-solo/db/kwl?orgId=1&from=now-1y&to=now&panelId=1" visibility=[Lueftung_ChartSwitch01==6]
		}

This works in both iOS and Android, also both local and via remote URL.

Can you please point out the benefit of your solution?

Hi @JohnnyX

I have gone for this solution because of what I’ve explained above, using the image renderer does work however on several occasions just looking at these graphs had resulted in lots of connections 60+ being established to my Graphana/InfluxDB pi ending up with no graphs and nothing getting captured in the dB from OH, I then have no choice but to power off the pi3 as I can’t even get ssh access.
If you have an idea how to stop this behaviour then please share otherwise I’m stumped and my complicated solution will just have to do for me.
Regards

Kevin

I propose to check in InfluxDB forum for a solution, seems to me related to an issue there, less to a problem in OH.

If I have been too straight forward, then I’m sorry for that. It’s good that you found a solution that works for you.

Hi @JohnnyX

No problem I just get frustrated with things that should just work and dont, the issue only started when I upgraded from OH2.1 to 2.2.

So I have implemented this as a workaround for now.

Kevin

Thanks Kevin. This was working for me. Before this I also changed allow_embedding what is required to use it inside a webview.

“ip address” refused to connect

enable anonymous access and allow_embedding both set to true

Tried both webview url and Image but none of them works. Please help!