Possibility to show grafana graph in sitemap via remote access?

Hi there,

like title said: Is there a possibility to show grafana graphs in my sitemap connecting via remote access (myopenhab)?
At the moment i am trying a few things with grafana & influxdb. These two things are workling great. Now i am trying to show these graphs in my sitemap. Connecting the openhab (android) app via local URL and showing the graph is working like a charm.

Image refresh=60000 Webview url="http://openhabianpi:3000/d-solo/000000001/home?panelId=1&orgId=1&tab=time%20range&theme=light" label="Temperaturverlauf" height=10

shows this:

And now I want to see this, accessing via remote URL, too.
I tried different things, but none worked.
Last try was to save an image and show it in the sitemap. Image has been created but “windows” shows me its an broken image and the sitemap doesn’t show something, too.

rule:

rule "saving image"
when Time cron "0 0/1 * 1/1 * ? *"
then
var test = executeCommandLine("curl -L 'http://openhabianpi:3000/d-solo/000000001/home?panelId=1&orgId=1&tab=time%20range&theme=light' -o /etc/openhab2/html/testimage.jpg", 5000)
logInfo("Test", test)
end
2019-01-11 15:45:00.476 [INFO ] [.eclipse.smarthome.model.script.Test] -   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

100    29  100    29    0     0   2548      0 --:--:-- --:--:-- --:--:--  2636

100 10512    0 10512    0     0   491k      0 --:--:-- --:--:-- --:--:--  491k

Sitemap

Image url="http://openhabianpi:8080/static/testimage.jpg"

Any ideas how to solve my problem? How did you manage this?
Don’t want to use the openhab graph, it is workling, but grafana is much more beautiful.

I´m not sure I understand your problem.

I use myopenhab (cloud) to enter my BasicUI. In there I can see Grafana charts just as fine as if I was connected locally.
It works both from myopenhab.org and from the Android openhab APP. I have not tried from my iPhone though, as I hardly ever use it.

And this is what i get logging in with android app via myopenhab.org??

The link doest seem right. It looks like you´re trying to connect to your Grafana server from the openhab App. This is not possible, as far as I know…

You´ll have to add the link to your Openhab server (NOT grafana server… Notice the port 3000. Thats the default Grafana server).

In the Android openhab App settings, you have to specify https://home.myopenhab.org:443
And then add username and pw…

Hmm wait… It could also be an error from the sitemap, right??
In that case it´s locally on your openhab/grafana server. It cant´resolved the openhabianpi:3000 (the Grafana server)… A bit strange if it works fine locally and not remote. It should be the same I believe.

Can you enter any sitemap from remote (through the app) ?

Can you enter any sitemap from remote (thorugh the app) ?

Yes, sitemap is working perfectly.

I think i am using the wrong link… Which one you are using? I think the " direct link rendered image" should be the correct one. But this gave me only a black screen (local and remote)?!

I´ll take a look tonight as I cant get to my files from here.
But I find it very strange if it works locally an not remote…Could be some arp chase though.

You need to create an html page in your html folder with a frame pointing to your grafana page

grafana.html

<html>
    <body>
        <iframe src="http://openhabianpi:3000/d-solo/000000001/home?panelId=1&orgId=1&tab=time%20range&theme=light"></iframe> 
    </body>
</html>

sitemap:

Image refresh=60000 Webview url="http://127.0.0.1:8080/static/grafana.html" label="Temperaturverlauf" height=10

Seems to work, but it brings me to the grafana login page which is not working…

BTW:
you wrote <htlm> instead of <html>
and in sitemap I have to use url="static/grafana.html"

Thats what i tried:

grafana.html

<html>
    <body>
        <iframe src="http://openhabianpi:3000/d-solo/000000001/home?orgId=1&panelId=1&from=1547202557396&to=1547224157396&theme=light" width="450" height="200" frameborder="0"></iframe> 
    </body>
</html>

sitemap

Image refresh=60000 Webview url="static/grafana.html" label="Temperaturverlauf" height=10

Results:
via local URL I shows me the grafana login page, where my login is not workling :frowning:
There is a short showing “login succesful” and brings me back to the login page
via remote: it shows me a “white” picture (there is a frame and nothing in it) and the openhab log shows me

2019-01-11 17:32:53.770 [WARN ] [io.openhabcloud.internal.CloudClient] - Jetty request 2143226 failed: null

2019-01-11 17:32:53.775 [WARN ] [io.openhabcloud.internal.CloudClient] - Response Failure: null

That’s the second time today
I put my hands up. It works for me…

I think I got a problem with my grafana setup. Myopenhab.org still tries to solve the grafana server with openhabianpi:3000 and not with a http(s).
I think I have to check my grafana setup.

did you try the IP address instead of the host name?

@vzorglub

did you try the IP address instead of the host name?

Same result :frowning:

What I noticed:
If I log in to normal myopenhab on a normal PC, BasicUI, PaperUI or whatever is resolving to https://home.myopenhab.org/xxx.
Grafana wants to resolve to openhabianpi:3000. Is it normal or is this my potential problem?

Try this:
BUT replace openhabianpi by 127.0.0.1 if you are running grafana on the same machine or by the lan IP
grafana.html

<html>
    <body>
        <iframe src="http://openhabianpi:3000/d-solo/000000001/home?panelId=1&orgId=1&tab=time%20range&theme=light"></iframe> 
    </body>
</html>

sitemap:

Image refresh=60000 Webview url="http://127.0.0.1:8080/static/grafana.html" label="Temperaturverlauf" height=10

Thats normal if you run Grafana server on your local network…
But…
If you have Grafana hosted outside your local network, then this IS your problem.

However, it should be the same, when you see a sitemap from local or external.

@vzorglub
This also did not solve the problem.
It only give me a “Connection refused error”. See picture.

And yes, grafana is running on the same machine

This is strange. It works for me.
Hands up. I don’t know

Of couse the above gives an error. You´re using port 8080. Thats not default for Grafana. Grafana uses port 3000.

Read the post above, this a redirected html page

But why redirect it? You can reach the panel from port 3000…

It could be permission issues as well, which makes sense for “Connection Refused” error.