InfluxDB+Grafana persistence and graphing

Not directly supported yet. See this discussion: http://stackoverflow.com/questions/30010364/multi-timeseries-operations-in-grafana

Yea - this it what I found, too.
Shame - this would really make up for some nice graphs.

In the mean time you can do the math in a rule and chart the result. Not as ideal but it is still possible to get where you want to go.

Hey guys,
I just updated the guide on all topics I wanted to mention in regards to “Building openHAB Diagrams in Grafana”. If I missed anything or you got followup questions, let me know.

The last topic will be “Showing diagrams in your openHAB sitemap” and I hope to have the time for it in the few days.

Yes - you are right and that is what I did. But this has the disadvantages that I can not change the math in retrospective and I am persisting redundant data.
I did like the corresponding feature request on github, so I’ll know when it will be available.

I’m finished with the guide. :fireworks:
From here on out I’ll try to update it from time to time based on discussions here in the comments. Good luck with your graphs and happy hacking!

4 Likes

Im struggeling with the install of grafana on an debian jessie i386 vm machine.
It looks like the grafana package for debian is only for amd?

any solution or am i on the wrong track?

Hey, this seems to be a problem. But there are solutions: https://github.com/grafana/grafana/issues/1968

I have 2 questions:

  • Did anyone test this on a windows machine?

  • Does Grafana also work with MySQL?

Thx & Regards
John

Hey @JohnnyX, sorry to be that guy but you would have been quicker googling this yourself :slight_smile:

first:

second:

thx got it running.
just one thing I found is, that with the newer version of influxdb the default retention policy is named autogen.

For openhab I needed to create a retention policy named default to get it working.

The generation speed to create png files is horrible slow on my ARM (Odroid U3). So the way to embed image charts is not interesting on such devices. I toked more then 16 seconds on a fast ARM device, RPi’s are much slower!

Hey @csowada, thanks for your input! I did not try on a raspberry pi yet but I hoped to make it work. Would be nice to be able to use “one for all” but yeah, we will see :wink:

For influxdb, they now produces official arm packages, so there is no need to build it yourself. For Pi, the article on aymerick’s blog deals with an old version of Grafana and things have changed a bit since then.

If you are on raspbian/jessie, it is relatively easy to build merely following the official build instructions. The only thing to be careful about is to get a PhantomJS for your pi and have it in your path, before the npm setup. On raspbian/wheezy, it is a bit more involved since Grafana requires a c++11 compliant g++. I wrote some explanation on how I proceed for wheezy and jessie.

For those not inclined in building the packages themself, you can have a look at the one I put on github which is for wheezy or jessie, tested by me on a raspberry pi 2 and reported to work on raspberry pi 3.

3 Likes

Hi,

I tried to set it up on a raspberry but I have a problem with the default RP as the current version of influxdb is v1.0.0. and in this version the RP created by default is named “autogen”

This makes imposible to persist data on OH. It shows an error
"error":"retention policy not found: default"

I tried to create a RP named “default” in influxdb, but it is not posible to create a RP with this name. Any other name is accepted.

> CREATE RETENTION POLICY default ON openhab_graf DURATION 72w REPLICATION 1 DEFAULT
ERR: error parsing query: found DEFAULT, expected identifier at line 1, char 25
Warning: It is possible this error is due to not setting a database.
Please set a database with the command "use <database>".

So, what is the solution?

I’m not sure about that problem and if it is of any meaning but your error is pretty clear. As the last line says, you just have to type use openhab_graf first.

I tried that, but still the error persists. Here you have an example with a diferent database name “openhab_db”

> use openhab_db
Using database openhab_db
> CREATE RETENTION POLICY default ON openhab_db DURATION 72w REPLICATION 1 DEFAULT
ERR: error parsing query: found DEFAULT, expected identifier at line 1, char 25
> 

Basically, “default” name as a RP can’t be used. Influxdb doesn’t accept it.

You can check the change request in github here:

Yes I know that thread. A good choice to rename it. The real question for me would be why you even need a retention policy and (because of xyz) why you insist to name it default


I only insist in creating a “default” RD because I am geting the following error message:

2016-09-27 21:05:54.404 [ERROR] [org.influxdb.impl.BatchProcessor    ] - Batch could not be sent. Data will be lost
java.lang.RuntimeException: {"error":"retention policy not found: default"}

Mi understanding is that the data is not being persisted because “default” RD doesn’t exist.

Is my assumption correct?

For what I see in the following post, the same error is happening with Telegraf + InfluxDB and in their GitHub their solve it upgrading Telegraf. Aparently the latest version on Telegraf takes into account the change of “default” to “autogen”

In my opinion a change must be done in the InfluxDB persistance OH module to support InfluxDB v1.0.0.101. Is that correct?

I just realized that such change has been already done in the last version on InfluxDB 1.9

There is a new parameter called: retentionPolicy that you can add in InfluexDB service

So just add the following line to influx.db

retentionPolicy=autogen