InfluxDB+Grafana persistence and graphing

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:

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

1 Like

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
}
kris@OpenHAB:/etc/openhab2/services$


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

Thanks

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.

/etc/openhab2/persistence/influxdb.persist

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) [...]

Ref: https://www.openhab.org/docs/configuration/persistence.html#items

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'.

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

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

1 Like

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

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:

1 Like

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.

:slight_smile:

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

1 Like

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!

1 Like

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?

Thanks
Kris

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?

Sometimes when changing Persistence config, you need to restart OH

1 Like

Thanks Vincent, ill give that a go!

Unfortunately that didnt fix it :frowning:

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)

1 Like

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

1 Like

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="http://192.168.0.3:3001/render/d-solo/7uU68LHiz/system-info-graphs?refresh=1m&panelId=16&orgId=1&from=1529315924660&to=1529920724660&tab=axes&width=250&height=200&tz=UTC%2B10%3A00" />
     			<div class="legend">Last 24 hours</div>
    </div>