InfluxDB+Grafana persistence and graphing

Tags: #<Tag:0x00007fe05e9a9098> #<Tag:0x00007fe05e9a8dc8> #<Tag:0x00007fe05e9a8760>

(Angelos) #548

You should use the default (Server)
The screenshot on the first post is from an older Grafana version. (we should update it)
On Grafana v5.1.4 (commit: a5fe24fcc) it looks like:

Ps: Whenever we have issues configuring stuff from a tutorial, it is better to open up a new thread, describe the steps that we took, and link to the tutorial. This keeps the tutorial thread “clean” with useful info that people can grab and less troubleshooting stuff :slight_smile:

(Kris K) #549

Thank you! now I can see it says Data Source is working :smiley:

(Kris K) #550

I have a stack of items I want to graph as part of the Matrix Theme that patrick setup and ive been following the tutorial. My systeminfo items are all OpenHAB_XXXX

Am I right in saying this strategy is sufficent to allow population of the items into Grafana for me to log?

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

Items {
    OpenHAB_*                           : strategy = everyChange

I’m new to all this. Sorry for the silly questions!


(Angelos) #551

The * is not a wildcard that can be applied to the Item names. It is used for <groupName>*
You should create/define/use a Group, assign all Items that you would like to persist their states to that Group and then persist the Group members.


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

    default = everyChange

Items {
    // persist all members of gInfluxDB Group on:  everyChange, everyHour, everyDay
    gInfluxDB* : strategy = everyChange, everyHour, everyDay

In your items:

Group		gInfluxDB
itemtype	itemname "labeltext [stateformat]" <iconname> (gInfluxDB) [...]


(Kris K) #552

Thanks. I’ve made those changes.

I see in the log, maybe unrelated

15:47:57.674 [ERROR] [ysql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'gInfluxDB'.

(Angelos) #553

why mySQL ? :slight_smile: that’s a competitor to our beloved InfluxDB !!! :stuck_out_tongue:
is your file called /etc/openhab2/persistence/influxdb.persist ?

(Kris K) #554

Success :smiley: I can see the openHAB items in the Grafana webUI :smiley: Thank you Dim

(Angelos) #555

tip: you can nest groups if you would like. Assign the sub-groups to the main group that is used in your persistence config (the gInfluxDB)

For example:
Put all systeminfo items in a gSysInfo group and then make that group a member of the big gInfluxDB Group.

Group		gInfluxDB
Group		gSysInfo	(gInfluxDB)
itemtype	itemname	"labeltext [stateformat]" <iconname> (gSysInfo) [...]

For more info, see:

  1. Design Pattern: Group Based Persistence
  2. YAGSA - Yet Another Group Structure Approach

(Kris K) #556

I dont even know why mySQL is there - maybe its in use for something else.

Thanks for the group info!

Now I just need to work out why theres no data in my graph :smiley:

(Angelos) #557

It seems that you have also installed in parallel the MysqlPersistenceService.
If you are not using it, uninstall it from PaperUI (Add-ons->Persistence)
You can have of course multiple Persistence Services running.


(Kris K) #558

I think its in use for something else. Ill find out why.

(Kim Andersen) #559

Just to let you know, @Confectrician and @jswim788
Things seems to be working just great now, after I changed to persistens file on your suggestions… Thank you both very much!

(Kris K) #560

Hi Guys,

Im using iframe in my Custom Widget which displays the graph correctly but it doesnt appear dynamic. I can see its updating in the webui of Grafana but not in my HabPanel widget. Any ideas?


(Kris K) #561

Hi All,

Ive added some new items with group ‘gSpeedtest’ , here is my persistence file. Grafana doesnt appear to show the items and if i show measurements in the influx client they are not listed…

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

    default = everyChange

Items {
// persist all members of gInfluxDB Group on: everyChange, everyHour, everyDay
    gInfluxDB*,gSpeedtest*  : strategy = everyChange, everyHour, everyDay

I restarted grafana-server & influxdb

Any thoughts?

(Vincent Regaud) #562

Sometimes when changing Persistence config, you need to restart OH

(Kris K) #563

Thanks Vincent, ill give that a go!

(Kris K) #564

Unfortunately that didnt fix it :frowning:

(Angelos) #565

try using 2 separate lines (this shouldn’t be the problem…)

    gInfluxDB* : strategy = everyChange, everyHour, everyDay
    gSpeedtest* : strategy = everyChange, everyHour, everyDay

or make gSpeedtest a member of gInfluxDB

Make sure that the Items included in the gSpeedtest group have a valid state (check from the console or REST)

(Kris K) #566

I checked about 1hr later and Grafana can see the items now :slight_smile: seems it needed some time ha.

(Kris K) #567

Am I right in saying a direct rendered image from Grafana will refresh it self using the following in HabPanel?

Is there anything further in Grafana I need to do to allow the graphs to refresh :frowning:

    <div class="graph">
    			<img width="250" height="200" src="" />
     			<div class="legend">Last 24 hours</div>