[SOLVED] InfluxDB openHAB stores no Data

Sorry :blush:

2 Likes

any progress?
influxdb persistence still doesn’t work for you?

g_ is not the Problem. Still not working

and TRACE on org.openhab.persistence.influxdb looks clean
 we have no hints to what could be wrong
 :frowning:

authentication seems to be set ok, but it’s worth double checking that part(?)

Could it be a problem with the retention policy?

1 Like

what do you mean? I used @ThomDietrich verison

Did you start from the beginning using InfluxDB 1.x or did you start using an older version?

Fresh InfluxDB

does grafana show you the test measurements that you introduced?
(and it doesn’t show anything else from the persisted items?)

Grafana displays the test measurements.
Nothing else. No other measurements are available to select.

Heyho!
And you are still seeing these messages?

09:57:11.719 [DEBUG] [.internal.InfluxDBPersistenceService] - influxdb persistence service activated
09:57:12.015 [DEBUG] [.internal.InfluxDBPersistenceService] - database status is OK, version is 1.3.4

If that’s the case your Items are not persisted, even though you’ve configured your system to do so. Issues like this are reported more often than I’d hope. They are almost always due to a spelling error in the persist file or due to a internal hiccup. Please check your influxdb.persist again, then restart openHAB. If nothing works also consider deleting cache and tmp just to tick that off as well


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

    default = everyChange
}

Items {
    g_INFLUX* : strategy = everyChange, everyHour, everyDay
}
Number C2MW97   "Wirkleistung L1 [JS(WtoKW.js):%s]"     (StraBaWe2OGUVBF05, g_MYSQL, gINFLUX)   {modbus="C2MW97:0"}

@ThomDietrich if you could point me to the Docs where I can read up how to clear the cache and tmp :wink:

     v
    g_INFLUX* : strategy = everyChange, everyHour, everyDay

versus

                                                                                     v
Number C2MW97   "Wirkleistung L1 [JS(WtoKW.js):%s]"     (StraBaWe2OGUVBF05, g_MYSQL, gINFLUX)   {modbus="C2MW97:0"}

So where is the Group definition? is it with underscore or without?

Quick note: Your everyHour+everyDay is redundant because the one includes the other :wink:

Second note: How is the group itself defined?

Third note: What is it, g_INFLUX or gINFLUX?

Forth note: The name choice is not good imho. You should use groups to organize Items based on their physical or logical nature. In the next step you can decide to have those persisted. In your example I’d rather define a group for “gWirkleistung”.

There is no documentation for that because it shouldn’t be needed normally. The steps are however part of the backup routine: http://docs.openhab.org/installation/linux.html#backup-and-restore

sudo systemctl stop openhab2
sudo rm -rf /var/lib/openhab2/cache/*
sudo rm -rf /var/lib/openhab2/tmp/*
sudo systemctl start openhab2
2 Likes
Group gMYSQL
Group gINFLUX

Sorry wrong copy pasta. both are gINFLUX

See above.

gINFLUX and gMYSQL are groups I use to persist Items.
Think of it like an on/off switch to persist an item.
Because I do have groups like Location, Electricity etc. but not all of them need to be stored.

Influx settings:

> settings
Setting           Value
--------          --------
Host              127.0.0.1:8086 (I just edited this so it does not display my real IP)
Username          openhab
Database          openhab_db
RetentionPolicy
Pretty            false
Format            column
Write Consistency all
Chunked           true
Chunk Size        0

Could this be a problem? Because there is nothing inside the field RetentionPolicy

The following sections cover how to create, alter, and delete retention policies. Note that when you create a database, InfluxDB automatically creates a retention policy named autogen which has infinite retention. You may rename that retention policy or disable its auto-creation in the configuration file.

Just testet my persist file with MySQL.
It seems like the following persist file is not working.

Strategies {
    everyHour : "0 0 * * * ?"
    everyDay  : "0 0 0 * * ?"
    default = everyChange
}
Items {
      gMYSQL* : strategy = everyChange, everyDay, restoreOnStartup
}

But this one is working

Strategies {
    everyHour : "0 0 * * * ?"
    everyDay  : "0 0 0 * * ?"
    default = everyChange
}
Items {
      * : strategy = everyChange, everyDay, restoreOnStartup
}

Still there is this WARN message:

10:17:03.761 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'mysql.persist' has errors, therefore ignoring it: [1,1]: mismatched
 input '<EOF>' expecting 'Strategies'

10:17:03.772 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'mysql.persist'

but it starts to persist stuff.

10:17:04.201 [DEBUG] [sql.internal.MysqlPersistenceService] - mySQL: Stored item 'C2MW97' as '740.05999755859375'[740.05999755859375] in SQL database
at 2017-09-05 10:17:04.2.

My thought.
There is a problem when trying to persist a group and its items.

I also noticed that MySQL is persisting but Influx is selected.

I tried to change the persistence restart openHAB.
Clear tmp and cache. Nothing so far seems to work.

but
 this means that the first character is being read wrong (?)
what text editor are you using to modify the *.persist files? (please don’t tell me Eclipse Smarthome Designer :stuck_out_tongue: )

I believe that this has to do with the default service that will be used for the rules (for statements like item.historicState).
If you have 2 persistence services configured, both will store the states.

Something is wrong with your influxdb.persist (and mysql.persist) file(s). Try to recreate it from scratch using vim.
I never had problems with my setup and I am persisting a lot of stuff in influxdb.

I have a gInfluxDB group and I add to that several members (other groups and/or individual items)

root@homer:~# more /etc/openhab2/persistence/influxdb.persist 
Strategies {
    everyHour : "0 0 * * * ?"
    everyDay  : "0 0 0 * * ?"

    default = everyChange
}

Items {
    // persist all members of gInflux Group on every change
    gInfluxDB* : strategy = everyChange, everyHour, everyDay
}
1 Like

this shouldn’t be a problem since:
a) You already were able to store the sample data
b) By default it uses autogen
c) I have the same output from settings in my influx

Emacs :slight_smile:
my *.persist files are not wrong :cry: MySQL persist looks the same!

mysql.persist

Strategies {
    everyHour : "0 0 * * * ?"
    everyDay  : "0 0 0 * * ?"
    default = everyChange
}
Items {
      * : strategy = everyChange, everyDay, restoreOnStartup
}

influx.persist

Strategies {
    everyHour : "0 0 * * * ?"
    everyDay  : "0 0 0 * * ?"
    default = everyChange
}
Items {
      * : strategy = everyChange, everyDay, restoreOnStartup
}