Analyzer persistence

Hi,

Seems the “analyzer” can only fetch data from the default persistence service, this makes some challenges for me as I like to use influxDB for the specific items I need metrics for, the rest uses mapDB since its more or less a waste of resources.
Are there any tricks, configuration or ways to get the analyzer to use a specific persistence service?

Yes. You can choose default, but there can be only one default.

You can’t get any useful charting from mapDB, why don’t you just set default to influxDB?

Or use chart pages, with more advanced options - I think you can choose data source.

I guess the term ‘default’ is confusing here. Default in this context means:

  • The persistence service used for the auto generated UI charts
  • The persistence service used in rules (when not specified in the rule)

Default does not mean “the persistence service that will automatically persist all available items”. What gets persisted is still only defined by the *.persist files.

Is that about right? I was confused about this the other day too, and the documentation only says you should set a default, but not why.

Yeah but I don’t want to use unessecary resources on items I don’t need persistence for. I’m afraid that’s my only solution though.

That’s what I’m trying to figure out, I’ve searched the forums but can’t find anyone that have done it.

Oh, I did not know that. Then that solves it I think :+1: :slightly_smiling_face:

Comment, in the absence of user created xx.persist files (i.e. default after installation) each newly installed service will use a default strategy to select Items for persist. This generally amounts to “everything you can”.
Note default strategy generally includes restore-on-startup as well.

Further comment, most OH3 installs will by default have installed rrd4j, assigned that as system default service (for analyze) and be using its default persist-and-restore strategy.

Oh really? Any idea if that’s hidden in the docs somewhere? So basically, for every new persistence service installed, irrespective of whether you set it to default or not, it will store everything it can until you manually create a persist file?

It seems so. No, I do not know of any docs. The default strategies are it seems different for different services.

A side effect is that all restore-on-startup as well, I think. Essentially harmless, just more churn at boot time.

1 Like

So I changed default persistene in the UI to influxdb and Influxdb has its own persistence file with no default strategy. Also, mapdb is installed with a default: everyUpdate strategy in its persistence file. ’
I did an update on an item that had no persistence defined (no group) and it was NOT added to the influxdb.
So my conclusion so far is that the default persistence defined by UI is superseded by any strategy defined in the files (ie. influxdb.persist or mapdb.persist). I guess this solves it for me :slight_smile:

Not really, as @hafniumzinc says -
“System default service” is just a pointer to which service to use for ‘analyze’ charts. It has no influence on what servicesare installed or what they persist, its just a pointer.

Each individual service will persist stuff by default, unless you define a xxx.persist file.

The docs makes it a little confusing and could be interpreted in different ways:

I can only speculate but I think its a choice in UI to make a persistence service work quick and easy without any file editing involved, but I don’t know…

Edit: I think we’re more and less in agreement, I may just be bad at explaining

That strategy is to store every supported Item on every change and every minute with restoreOnStartup.

There are two things here.

If you install OH 3.x from scratch, rrd4j is installed by default. No .persist file exists so it uses the default strategy (see above).

If you’ve upgraded from OH 2.x or are using addons.cfg to manage your add-ons, rrd4j is not installed by default.

All persistence add-ons will save Items based on their persistence strategy. In the absence of a .persist file, the default strategy implemented by that add-on is used.

Which persistence add-on is configure as the default in MainUI has no bearing on this. That only indicates what persistence add-on to use for queries in the absence of an argument specifying which to use.

I am pretty sure I addressed this in the Getting Started Docs. The default strategy for each add-on is (at least for the ones I spot checked) documented in that add-on’s docs. I believe this was also included in the 3.0 announcements. The Persistence documentation page states:

openHAB ships with rrdj4 as the default persistence database and comes with a default persistence strategy of everyChange, everyMinute, and restoreOnStartup for every supported Item. The good thing about rrd4j is that the database never grows beyond a given size, so you never have to clean it up. However, the way it achieves this (replacing ten readings with the average of the ten readings as the data gets older) makes the database not work for all Item types. If you need to restoreOnStartup unsupported Item types, MapDB might be a better choice for you.

This “default strategy” would be good to know. I’ve looked at the JDBC docs page, and nothing is mentioned there, for example.

OK - I looked in the Persistence docs within Configuration, not Getting Started. I view the Getting Started as “Welcome to OH3, here’s how to get started”.

I can’t find that in the Persistence documentation. I can see that there are two pages called Persistence in the docs. Because I only care about configuring persistence, I looked in the Configuration section.

Appreciate your response on this. It’s certainly clearer for me, except for what the “default strategy” actually is for each service.

Please file an issue. It should be documented there and for each persistence add-on. It is for rrd4j and mapdb (though MapDB seems to be missing at the moment???). It should be for all of the persistence add-ons.

Given how much has changed, everyone should look through the Getting Started. So so many threads from experienced 2.x users would not have been needed if everyone would give even just a cursory look through Getting Started.

It also helps to tie together a lot of these new features in OH. “Why did they do that?!” is often answered when you see it explained end to end. For example, why does OH 3 come with rrd4j with a save everything strategy by default? So beginners are not surprised when their charts don’t work because they neglected to go configure something from scratch.

I noticed that - the documentation link provided by the binding within the OH3 UI points to v2.openhab. There is no v3 version.

I get what you’re saying. I believe that if the Getting Started docs include new information that should also be reflected in the ‘main’ docs. I’ll have a look at this.

Apologies @lfs_alp5 for going slightly off piste!

They don’t include new info. Everything there is also reflected in the reference docs. But the reference docs don’t show how it all works together.

No worries, this is all good information :slightly_smiling_face:

I disagree, because I can’t even find some of the great info in your first post within the reference docs. But as I say, I’ll find some time to try and add detail to at least the Persistence page.