InfluxDB+Grafana persistence and graphing

influxdb
graphs
grafana
Tags: #<Tag:0x00007fd3039334c8> #<Tag:0x00007fd303933388> #<Tag:0x00007fd303933248>

(Eric Schiesser) #568

I can’t seem to get the Webview working outside of my LAN. Image works fine, but the Webview just fails to load and I get an empty iframe in BasicUI (in Chrome). Here is the relevant code:

html/chartsDay.html

<!DOCTYPE html>
<html>
<head>
        <meta http-equiv="Content-type" CONTENT="text/html; charset=utf-8">
        <link rel="stylesheet" type="text/css" href="charts.css" />
</head>

    <div class="container">
        <iframe src="http://192.168.1.2:3000/d/Xlu8IxNik/test?orgId=1&from=now-24h&to=now&panelId=4"></iframe>
    </div>
  </br>
</html>

sitemap:

Webview height=33 url="http://192.168.1.8:8080/static/chartsDay.html"

Is this because I am using a reverse proxy? How can I get the Webview elements to load outside my LAN? Note that, even inside my LAN, using my FQDN to connect to OpenHAB does not load the Webview. This points to something wrong with the reverse proxy, I guess? How can I get this working?

Edit:
If I inspect the source of the BasicUI frame that is supposed to contain the Webview, these lines stick out to me:

........
<html class=" ui-layout-condensed ui-icons-enabled ">
<div class="mdl-form__row mdl-form__row--height-auto mdl-cell mdl-cell--12-col ">
	<div
		class="mdl-form__control mdl-form__webview"
		data-control-type="webview"
		data-widget-id="020300"
	>
		<iframe src="http://192.168.1.8:8080/static/chartsDay.html" height="36"></iframe>
	</div>
</div>

Does the Webview simply “pass on” the link to the html file, without loading any of the resources that html file calls on? (Please excuse my imprecise terminology).

If the Webview is just passing a link to the html file, I can’t see how anyone has gotten this working without putting a FQDN in their Webview, and then exposing Grafana to the internet as well (and then changing the URLs in their html files to contain FQDNs as well).

Has anyone gotten the Webview working with their Openhab behind a reverse proxy?


(John Schmitz) #569

You’ve specified absolute time for your graph, so it will always be the same. You probably want something like:

&from=now-24h&to=now

(Eric Schiesser) #570

You are correct, but that is beside the point if the chart can’t be loaded in the first place :stuck_out_tongue:


(Daniel Walters) #571

The previous post was likely not a response to you but to a previous post looking for help.


(Moxified) #572

I updated to the latest grafana (5.1.4 on debian) a few days ago and this type of time no longer works, only the epoch time ranges. Anybody seen this?


(Kim Andersen) #573

I´m using 5.1.4 as well, and the time periode &from=now-24h&to=now do indeed work. I use it to show several panels (dashboards).


(Kris K) #574

Thnak you John ive no idea why I couldnt get that right. Thats fixed the issue :slight_smile:


(Moxified) #575

Thanks for confirming that. It’s working again and I didn’t change anything so I’ll have to poke around some more.


(Kim Andersen) #576

Sorry, I was wrong… It´s 5.1.3 I am using… I thought it was the latest as I installed it last week.


(Rich Koshak) #577

I’m pretty sure that webviews outside your lan had never worked. The only way it can work is if you use an external url door the webviews (i.e reverse proxy Grafana too and use the external url). If you can’t bring it up using https://mydyndns.com/blah/blah/blah it won’t work.


(Moxified) #578

Yeah, it’s not working again. I’m going to have to do some digging as something is flakey and all I did was apt upgrade on the grafana server.


(Eric Schiesser) #579

Thanks for the reply. Glad to know I’m not just overlooking something. Clearly I’m not experienced with using iframes or webviews because that probably would have been obvious!

I will probably settle for the static images. Thanks!


(Kris K) #580

Yes, I had to reference my external DNS name for the graphs to be visible outside. Makes sense. I just use the external url both locally and externally. It loads them fine.


(Christoph Wempe) #581

I recently noticed I persisted some values every 5 seconds instead of every 5 minutes.
And I did that for over a year.

Is there an elegant way to delete every value except for “every 5 minutes” in influxdb?

I think my influxdb container does use too much memory )~1GB) because of this issue and I want to fix ist. :slight_smile:


(Jean-Claude) #582

You can downsample your data from your measurement into a new measurement and then copy the data back directly in influx with a command like:

$ influx
> use your_database
SELECT mean("value") AS value INTO "new_measurement" FROM "your_measurement" GROUP BY time(5m)

check if the data are correct:

SELECT * FROM "new_measurement" LIMIT 5

then you can drop your measurement:

DROP MEASUREMENT "your_measurement"

and copy back the data from your new measurement:

SELECT * INTO "your_measurement" FROM "new_measurement" GROUP BY *

then exit

> exit

(Christoph Wempe) #583

Sounds like really good plan.
Thanks!

I will try this.


(Udo Hartmann) #584

Not to forget, after copying new_measurement to your_measurement, you can also drop new_measurement :wink:


(Nils Frahm) #585

Hey guys, i am very new to raspi, openhab, linux and everything here. Not so easy to get in here.

Just want to say hello and ask a short question: Is this guide still uptodat and working ?


(Angelos) #586

Yes
There may be some minor info that are outdated but the guide in the first post should be ok.

Welcome :slight_smile:


(Nils Frahm) #587

Ok, thx for the answer. Look like i did most of this guid right. i got the sine wave.

I already build a weatherstation with openhab2 only. Now i have no idea how to bring the DHT22 or online weatherdata to the influx DB :smiley:

i dont have to work tomorrow so it looks like i have many time to try and error with google :smiley: