Hardware: 64-bit 4 cores/2GB RAM/128GB HDD (This is actually a virtual machine, but these are the specs it’s been dealt)
OS: Debian Stretch (9.5)
Java Runtime Environment: Zulu 8.31.0.1-linux64
openHAB version: 2.3.0
I’m trying to configure persistence with InfluxDB but it doesn’t seem to be storing any data. I got inspired by [InfluxDB+Grafana persistence and graphing] but I’ve already got a InfluxDB/Grafana setup on another host already so I wanted to use that. I set up a separate db and user for openHAB. I verified that they work using Grafana.
/etc/openhab2/services/influxdb.cfg:
# The database URL, e.g. http://127.0.0.1:8086 or https://127.0.0.1:8084 .
# Defaults to: http://127.0.0.1:8086
url=http://<influxdb host ip>:8086
# The name of the database user, e.g. openhab.
# Defaults to: openhab
user=openhab
# The password of the database user.
password=<myverysecretpassword>
# The name of the database, e.g. openhab.
# Defaults to: openhab
db=openhab
# Retention policy
retentionPolicy=autogen
/etc/openhab2/persistence/influxdb.persist:
Strategies {
everyHour : "0 0 * * * ?"
everyDay : "0 0 0 * * ?"
// if no strategy is specified for an Item entry below, the default list will be used
default = everyChange
}
Items {
rfxcom_* : strategy = everyChange, restoreOnStartup
zwave_* : strategy = everyChange, everyHour
}
In the logs, even with DEBUG, all that I can ever find about persistence is this during startup:
2018-09-02 19:42:33.236 [DEBUG] [.InfluxDBPersistenceServiceActivator] - InfluxDB persistence bundle has been started.
2018-09-02 19:42:33.237 [DEBUG] [org.openhab.persistence.influxdb ] - BundleEvent STARTED - org.openhab.persistence.influxdb
2018-09-02 19:42:33.269 [DEBUG] [.internal.InfluxDBPersistenceService] - influxdb persistence service activated
2018-09-02 19:42:33.445 [DEBUG] [.internal.InfluxDBPersistenceService] - database status is OK, version is 1.3.1
2018-09-02 19:42:33.517 [DEBUG] [org.openhab.persistence.influxdb ] - ServiceEvent REGISTERED - {org.openhab.core.persistence.PersistenceService, org.openhab.core.persistence.QueryablePersistenceService}={service.id=342, service.bundleid=215, service.scope=bundle, user=openhab, url=http://<influxdb host ip>:8086, component.name=org.openhab.persistence.influxdb, component.id=221, password=<myverysecretpassword>, retentionPolicy=autogen, service.pid=org.openhab.influxdb, db=openhab} - org.openhab.persistence.influxdb
I also set influxdb as the default persistence in Paper UI -> Configuration -> System
Any ideas?
Do you have a group item named rfxcom_? because the meaning of rfxcom_* in the persist-file is:
“Take all members of this group and persist them with following strrategies.”
In other words rfxcom_ is the exact name of the group, which members should be persisted. The group item itself will not be persisted.
Oh! I thought that was just a way to wildcard any item names! I’ll try replacing those with exact item names instead. But shouldn’t the “default” line in Strategies make every item persist if they are not defined in Items (in influxdb.persist)? Or is that another misunderstanding from my side?
Strategies {
everyHour : "0 0 * * * ?" //self defined strategies
everyDay : "0 0 0 * * ?"
// if no strategy is specified for an Item entry below, the default list will be used
default = everyChange
}
Items {
group* : strategy = everyChange, restoreOnStartup //persist all direct members of the group 'group'
item : strategy = everyChange, everyHour // persist the item 'item'
otherItem // no strategy set, so use default strategy for item 'otherItem'
* : strategy = everyChange // persist every item
}
Hello,
I have a very similar problem with storing openhab data in influx. On my Synology, I installed influxdb, grafana and OH binding.
The openhab settings are almost exactly the same as malgoe posted at the beginning of this blog. The only difference is: I don’t use a group item, but a simple item tracking a temperature every minute. I checked all spellings several times - seems to be ok.When I SSH to influx console it shows the following:
use openhab
Using database openhab
auth
username: openhab
password:
settings
Setting Value
Host localhost:8086
Username openhab
Database openhab
RetentionPolicy
Pretty false
Format column
Write Consistency all
Chunked true
Chunk Size 0
SHOW series
SHOW measurements
Seems. that influx knows the DB openhab and the user (I checked it in the Web GUI of influx, too - its ok.). But no series, no measurements … I use in parallel rrd4j, there the item record is ok.
Any idea, what’s going wrong?
Just tried to start the debugger in Visual Studion Code,—> error “Die Laufzeit ‘node’ wurde in PATH nicht gefunden. " When using KARAF, I cannot execute comman log:set DEBUG --> Error executing command: Unrecognized configuration”. Seems I have to fight with the debugger first…
In VSCode there is no debugger active for openHAB yet but I think you don’t need it as openHAB does online code checking.
In question of logs: Please take a look at /var/log/openhab2/openhab.log. There should be some lines about influxDB persistence Service.
You can set the log level for influxDB by using the karaf console:
log:set DEBUG org.openhab.persistence.influxdb
the default level would be
log:set DEFAULT org.openhab.persistence.influxdb
There is also a TRACE level if DEBUG will not suffice.
Thanks for the hint that VSC has no OH debugger. Unfortunately, in the openhab.log file there a no lines at all! I set up OH 2.3.0 completely from scratch, with the same result. My OH items and rules should generate a whole bunch of events - but nothing is logged. Seems that the general logging level is just ERROR, and I don’t know how to switch to a higher level.
I tried the log:set command in KARAF. I can enter the log subshell, but for the set command you proposed I get “error executing command: Unrecognized configuration”.
At the moment, I am not able to generate any debug infos. What can I do?
Thanks for your help.
Sorry for bothering you again.
I found an entry in …org.apache.karaf.shell.cfg where a debug level can be changed. I am not sure whether this is the right place, but I changed it to level=3 (debug). After restarting my Synology (!!! just restarting openhab changed nothing) I found the following entries in openhab.log