[SOLVED] OpenHab InfluxDB data is not persisting

Hello,
I am using OpenHab2.4 and installed Influx and Grafana for visualization purposes. This setup is working fine for past couple of months but now when i wanted to add some more items in persist file, they are not appearing in influxDB “Show series” output or in grafana. All previously added items are persistent and being plotted in grafana but new items are not appearing.
Below are my cfg file:
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(s)://<host>:<port>
url=http://172.29.60.2:8086
# The name of the database user, e.g. openhab.
# Defaults to: openhab
# user=<user>
user=openhab
# The password of the database user.
# password=
password=openhab
# The name of the database, e.g. openhab.
# Defaults to: openhab
# db=<database>
db=openhab_db
retentionPolicy=autogen

# Enable authentication in the [http] section of the configuration file /etc/influxdb/influxdb.conf:

[http]  
enabled = true  
bind-address = ":8086"      # change to a specific interface if needed 
auth-enabled = false         # will enforce authentication

influxdb.persist

Strategies {
everyMinute : "0 * * * * ?"
everyHour : "0 0 * * * ?"
everyDay : "0 0 0 * * ?"
every2Minutes : "0 */2 * ? * *"
}

Items {
L1V : strategy = everyChange
L1A : strategy = everyChange
L1P : strategy = everyChange
L1PF : strategy = everyChange
L1F : strategy = everyChange
L1AE : strategy = everyChange
B112F2FESP1PIR2_Motion : strategy = everyChange 

B112FESP1PIR2_Action : strategy = everyChange

Every item except for the last two is persisted and is showing in influx.
Below are the item definitions:

String B112F2FESP1PIR2_Motion {mqtt="<[demo:B112F2FESP1PIR2/motion:state:default]"}

Number B112F2FESP1PIR2_Action {mqtt=">[demo:B112F2FESP1PIR2/action:command:*:default]"}

Persisted Item:

Number L1P “Power A [%.1f W]” {mqtt = “<[demo:sdm120/pow:state:default]”}

Any Help would be appreciated.

Your item is named: B101FHallESP1PIR1_Action

And you are trying to persist: B112F2FESP1PIR2_Motion

Notice the difference?

Sorry for the typo, but Both Items exist in items file. Edited the OP.

Did you restart OH after updating the persist file?
It is sometimes necessary to do that

Several times, i even restarted the server itself multiple times.

You may need to find and remove the xxx.config cached version of the file

These are the contents of this file: influxdb.config

auth-enabled=“false\ \ \ \ \ \ \ \ \ #\ will\ enforce\ authentication”
bind-address="":8086"\ \ \ \ \ \ #\ change\ to\ a\ specific\ interface\ if\ needed"
db=“openhab_db”
enabled=“true”
password=“openhab”
retentionPolicy=“autogen”
service.pid=“org.openhab.influxdb”
url=“http://172.29.60.2:8086
user=“openhab”

removed the file and started OH but still no new entry in influx…

Where did this come from?
If you have this in your influxdb.cfg, remove it, then delete the influxdb.config again and restart again.

This is the basic influxdb.cfg:

BTW, those changes (auth-enabled, bind-adress) have to go to the influxdb.conf file:

https://docs.influxdata.com/influxdb/v1.7/administration/config/

You have an influxdb.cfg: configuration for openHAB
influxdb.config: cache contents of influxdb.cfg (do not edit manually!)
influxdb.conf: general configuration of influx outside of openHAB

1 Like

This is how my files are looking now
/etc/openhab2/services# more 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(s)://<host>:<port>
url=http://172.29.60.2:8086
# The name of the database user, e.g. openhab.
# Defaults to: openhab
# user=<user>
user=openhab
# The password of the database user.
# password=
password=openhab
# The name of the database, e.g. openhab.
# Defaults to: openhab
# db=<database>
db=openhab_db
retentionPolicy=autogen

I changed [http] settings in /etc/influxdb/influxdb.conf

restarted OH and Influxdb.service.
This is what i got when i restarted persistence bundle.

==> /var/log/openhab2/openhab.log <==
2019-08-30 02:23:47.678 [DEBUG] [org.openhab.persistence.influxdb    ] - BundleEvent STOPPING - org.openhab.persistence.influxdb
2019-08-30 02:23:47.726 [DEBUG] [org.openhab.persistence.influxdb    ] - ServiceEvent UNREGISTERING - {org.openhab.core.persistence.PersistenceService, org.openhab.core.persistence.QueryablePersistenceService}={service.id=301, service.bundleid=205, service.scope=bundle, user=openhab, url=http://172.29.60.2:8086, component.name=org.openhab.persistence.influxdb, component.id=188, password=openhab, retentionPolicy=autogen, service.pid=org.openhab.influxdb, db=openhab_db} - org.openhab.persistence.influxdb
2019-08-30 02:23:47.732 [DEBUG] [.internal.InfluxDBPersistenceService] - influxdb persistence service deactivated
2019-08-30 02:23:47.786 [DEBUG] [.InfluxDBPersistenceServiceActivator] - InfluxDB persistence bundle has been stopped.
2019-08-30 02:23:47.800 [DEBUG] [org.openhab.persistence.influxdb    ] - ServiceEvent UNREGISTERING - {org.osgi.service.cm.ManagedService}={service.id=300, service.bundleid=205, service.scope=singleton} - org.openhab.persistence.influxdb
2019-08-30 02:23:47.832 [DEBUG] [org.openhab.persistence.influxdb    ] - BundleEvent STOPPED - org.openhab.persistence.influxdb
2019-08-30 02:23:47.846 [DEBUG] [org.openhab.persistence.influxdb    ] - BundleEvent STARTING - org.openhab.persistence.influxdb
2019-08-30 02:23:47.855 [DEBUG] [.InfluxDBPersistenceServiceActivator] - InfluxDB persistence bundle has been started.
2019-08-30 02:23:47.858 [DEBUG] [org.openhab.persistence.influxdb    ] - BundleEvent STARTED - org.openhab.persistence.influxdb
2019-08-30 02:23:47.879 [DEBUG] [org.openhab.persistence.influxdb    ] - ServiceEvent REGISTERED - {org.osgi.service.cm.ManagedService}={service.id=366, service.bundleid=205, service.scope=singleton} - org.openhab.persistence.influxdb
2019-08-30 02:23:47.895 [DEBUG] [.internal.InfluxDBPersistenceService] - influxdb persistence service activated
2019-08-30 02:23:47.908 [DEBUG] [.internal.InfluxDBPersistenceService] - database status is OK, version is 1.7.6
2019-08-30 02:23:48.030 [DEBUG] [org.openhab.persistence.influxdb    ] - ServiceEvent REGISTERED - {org.openhab.core.persistence.PersistenceService, org.openhab.core.persistence.QueryablePersistenceService}={service.id=367, service.bundleid=205, service.scope=bundle, user=openhab, url=http://172.29.60.2:8086, component.name=org.openhab.persistence.influxdb, component.id=222, password=openhab, retentionPolicy=autogen, service.pid=org.openhab.influxdb, db=openhab_db} - org.openhab.persistence.influxdb

Output of influx Show series command:

> show series
key
---
L1A
L1AE
L1F
L1P
L1PF
L1V

Still no new items in the DB.

Can you show us one of your missing Items changing in events.log, and any related debug output?

1 Like

Oppss… these items were not updating. after adding another item that was actually changing its state/value i got the value in Influx.
So the real issue was with the influx.cfg file being incorrectly configured.

Thanks everyone for the help.

2 Likes

Coolio. Please mark the thread as solved, thanks