InfluxDB+Grafana persistence and graphing

influxdb
graphs
grafana
Tags: #<Tag:0x00007f014cc76858> #<Tag:0x00007f014cc76650> #<Tag:0x00007f014cc764e8>

(Baki Med) #588

Hello @ThomDietrich
I’m sorry to get you back this old but am really clueless with grafana, I tried to install it through openhabian-config and with your method but am always stuck while:

Executing: /tmp/apt-key-gpghome.FapIGOf3st/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 379CE192D401AB61

I don’t know what to do, I’m still new to OpenHAB and couldn’t find solution.
Added to that, I installed the persistence in PaperUI but it’s always showing blank black screen.


(Stefan Steiner) #589

Hi,

I successfully was able to show a chart with grafana, influxdb and a webview how it was described in this tutorial.

Now I want to achieve changing the duration of the chart via three buttons.

Here I have a problem when changing the visibility for web views. Only renders the title bar.

Here is the sitemap

Switch item=TemperatureSensor_ChartPeriod icon="chart" mappings=[0="Stunde", 1="Tag", 2="Woche"]
                Webview url="/static/chartHour.html" visibility=[TemperatureSensor_ChartPeriod==0, TemperatureSensor_ChartPeriod=="NULL"] height=10
                Webview url="/static/chartDay.html" visibility=[TemperatureSensor_ChartPeriod==1] height=10
                Webview url="/static/chartWeek.html" visibility=[TemperatureSensor_ChartPeriod==2] height=10

In the html file I have an iframe with the grafana url inside.

The problem is that if I switch to another view. e.g. “Day” only the header of the chart is rendered.

I would appreciate any help.

Thanks,

Stefan


(Kees Van Gelder) #590

@ThomDietrich Thanks for great tutorial. Not only did it helpme setup Influx and Grafana, but your Sinewave example taught me how to fill influxDB fromPython as well.

@rlkoshak thanks for some of your examples that taught me there is much more possible than I intitially thought,such as two different scales on the left and right Y axis

@rtvb

Thanks, I could have sworn it should be every15Min :"*/15 * * * * ?", But yours is correct. Darn, cant trust the various Cron generators


(Rich Koshak) #591

You can trust the Quartz Cron generator. That is the library used in OH and it different from “standard” Cron in that it goes down to the seconds. Most other crons only go down to the minute.


(Kees Van Gelder) #592

Ah good to know. Thanks


(NOTORIOUS VR) #593

Sorry but I followed this fantastic thread to a tee, and as far as I can tell Influxdb is installed, as is Grafana, all the .cfg files are configured.

But none of my logs show anything useful at all… Even adding extra logging info to org.ops4j.pax.logging.cfg does nothing (the log file doesn’t even get created!). It’s as if openhab can’t see influx or can’t use it.

Not sure where to go from here. I’ve double checked everything I can think of from this thread and others. I don’t see anything out of place.

Any assistance would be appreciated!

influxdb.cfg:

# The database URL, e.g. http://127.0.0.1:8086 or https://127.0.0.1:8084 .
# Defaults to: http://127.0.0.1:8086
# url=http://127.0.0.1:8086

# The name of the database user, e.g. openhab.
# Defaults to: openhab
# user=openhab

# The password of the database user.
password={REDACTED}

# The name of the database, e.g. openhab.
# Defaults to: openhab
db=openhab_db

# The retention policy to be used, needs to configured in InfluxDB
# Till v0.13: 'default', since v1.0: 'autogen'
retentionPolicy=autogen

infpluxdb.persist:

Strategies {
    everyMinute : "0 * * * * ?"
    everyHour   : "0 0 * * * ?"
    everyDay    : "0 0 0 * * ?"
}

Items {
    gHeatAct*, gHeatSet*, gHeatValve*   : strategy = everyChange, everyHour
    Presence_Phone                      : strategy = everyChange
}

running SHOW MEASUREMENTS or SERIES doesn’t return anything in the influx cmd line either, so it seems like nothing is actually being written to the DB


(John Schmitz) #594

Do you actually have Items and Groups with the names you list in influxdb.persist? I think those were meant as examples. You need to customize for your specific items.


(NOTORIOUS VR) #595

Damn, I see what you mean now… I’ll check that right now and report back.

Thanks!

EDIT: That’s exactly what it was! Thank you for the tip!


(Mark) #596

Hi,
I have been researching how to setup InfluxDB and Grafana on my Openhab2 Raspberry Pi3b Stretch setup
and I came across this good read:

It wasn’t clear to me from this thread that I could install both InfluxDB and Grafana simply using the Openhab config menu

sudo openhabian-config

and select optional components.

Is there a reason this is not mentioned at the top of thread? Or to put it another way, what is best method to get InfluxDB and Grafana up and running on my Rpi3b Stretch?

I checked the link in this thread to RPi setup and it talks about Jessie. I assume for Stretch I just replace the words ‘Jessie’ with ‘Stretch’ for the correct install. Correct?

Thanks Mark.


(Rich Koshak) #597

openHABian is not the only way to install and manage an openHAB installation.

When this article was written, I don’t think openHABian supported installing InfluxDB and Grafana. I may be mistaken, but I’m not even sure there was an openHABian at that time.

The instructions are also generic enough such that should users want to host InfluxDB and Grafana on a VM or server separate from openHAB they can do it.

If you are using openHABian, use openhabian-config. If not, use the instructions above to install.

I’m pretty sure there is nothing else different between the two so that should work.


(Christoph Wempe) #598

This might be interesting for some of you. :grin:


(Daniel N.) #599

Hello,
is there a way to outsource the infludb to a USB stick?
And if so, how can i do that?

Greetz
Daniel


(Rich Koshak) #600

Google is you friend.

Note that a USB drive is no better than an SD card. It too will wear out with enough writes.


(Elie Hanna) #601

Hey All,

A small help is needed please, a message in frontail logs keeps popping up from time to time:

2018-08-10 12:16:41.838 [ERROR] [org.influxdb.impl.BatchProcessor ] - Batch could not be sent. Data will be lost

java.lang.RuntimeException: {“error”:“timeout”}

at org.influxdb.impl.InfluxDBErrorHandler.handleError(InfluxDBErrorHandler.java:19) [205:org.openhab.persistence.influxdb:1.12.0]

at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:242) [205:org.openhab.persistence.influxdb:1.12.0]

at org.influxdb.impl.$Proxy127.writePoints(Unknown Source) [205:org.openhab.persistence.influxdb:1.12.0]

at org.influxdb.impl.InfluxDBImpl.write(InfluxDBImpl.java:151) [205:org.openhab.persistence.influxdb:1.12.0]

at org.influxdb.impl.BatchProcessor.write(BatchProcessor.java:171) [205:org.openhab.persistence.influxdb:1.12.0]

at org.influxdb.impl.BatchProcessor$1.run(BatchProcessor.java:144) [205:org.openhab.persistence.influxdb:1.12.0]

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]

at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]

at java.lang.Thread.run(Thread.java:748) [?:?]

I’ve read the in this topic how to solve it and i added the "retentionPolicy=autogen"in the influxdb.cfg file the restarted the RPi but the problem still remain noting that all the functionality of Influx and Grafana are working properly.

Please advise !!

Thank you


(Elie Hanna) #602

Hey All,

Problem solved by changing the SD card, a small hint for anyone may face this issue to use a better SD card with faster through put.

Regards,


(Kotik) #603

Hello,

Which seems to be the best way of updating Grafana to the latest release (v5.2.2)?

I am using iframes to embed graphs and the Grafana version (v5.1.4) that is installed with Openhabian has a bug with iframes and a vertical scroll bar.

This is fixed in latest release.

Any suggestions are welcome.

P.S. I tried:
sudo apt-get update
sudo apt-get install grafana

and it reports that the latest version is already installed…


(Nakh Home) #605

I do not know why but the image is really tiny

                Frame label="Chromecast" icon="chromecast" {
                   Default item=Chromecast_LG_ReleaseDate            	   	
                }
           Image refresh=60000 url="http://192.168.1.110:3000/render/d-solo/WF5DmCigk/a1?panelId=2&orgId=1&&from=now-48h&to=now&width=1000&height=500&tz=UTC%2B03%3A00"
        Frame label="Sensors-A1" icon="temperature" {		 
            Default item=mqtttemperature icon="temperature"
        }	
    }

(Kotik) #606

To answer my own question, Grafana now officially supports armv7 and they have the latest version available for it:)

I had to run:
wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_5.2.2_armhf.deb
sudo dpkg -i grafana_5.2.2_armhf.deb

and my Grafana updated to latest stable release that has the “iframe” scrolling issue fixed.


(Eric Geiger) #607

Hi Guys,

is there a possibility to build graphs out of openHAB for forecast data. I want to build a forecast graph for a power calculatioin for the next 5 days. In openHAB I have more than one Item. My problem is that I only can persist one Item which persist the past. But I want to show the forecast. And how can I put more than one Item in a line for graphing the forecast data?

Thanks!


(5mark) #608

Thanks for this great tutorial. Its really amazing what you can do with grafana and openhab
May I suggest to add the possibility of using grafana’s kiosk mode to add your graphs as webview / frame to a dashboard to the tutorial?

I think its by far the easiest way to display your graph in HABpanel.

just add &kiosk=1 to the url of your dashboard. this will hide all of grafana’s menu items.