No data into InfluxDB

I’ve seen the several threads on the same topic, but they didn’t help me.

Ubuntu 20.04, OpenHab 2.5.9
I followed the InfluxDB+Grafana persistence and graphing.
I was able to use the sine.py sample to get some data into InfluxDB and visualize it in Grafana.

$ ls -l /etc/openhab2/services
total 24
-rw-r--r-- 1 openhab openhab 2269 Aug 23 06:45 addons.cfg
-rw-r--r-- 1 openhab openhab  618 Dec 28 13:31 influxdb.cfg
-rw-r--r-- 1 openhab openhab  335 Dec 28 13:55 influxdb.persist

I started with userid openhab in InfluxDB, but then reverted to the admin account, as I saw others having a problem with permissions in InfluxDB (note that my sine.py is able to pump data):

$ cat /etc/openhab2/services/influxdb.cfg
url=http://192.168.0.3:8086

#user=openhab
user=admin
#password=<openhab-password>
password=<admin-password>

db=openhab_db
retentionPolicy=autogen

$ cat /etc/openhab2/services/influxdb.persist 
Strategies {
    everyMinute : "0 * * * * ?"
    everyHour   : "0 0 * * * ?"
    everyDay    : "0 0 0 * * ?"

    default     : everyChange
}

Items {
    EnergyMeter_kwh : strategy = everyChange
    Ws2902a_Temperature : strategy = everyChange
    Laptop_power : strategy = everyChange, everyMinute
}

In influx:

> settings
Setting           Value
--------          --------
URL               http://localhost:8086
Username          admin
Database          openhab_db
RetentionPolicy
Pretty            false
Format            column
Write Consistency all
Chunked           true
Chunk Size        0

> show series
key
---
sine_wave

I’ve increased logging levels:

openhab> log:list | grep persistence
org.openhab.persistence.influxdb | TRACE
org.openhab.persistence.mapdb    | DEBUG

Restarted the entire OpenHhab service and also the InfluxDB bundle.

grep -i influxdb /var/log/openhab2/openhab.log:
2020-12-28 14:03:06.398 [DEBUG] [.InfluxDBPersistenceServiceActivator] - InfluxDB persistence bundle has been started.
2020-12-28 14:03:06.408 [DEBUG] [.internal.InfluxDBPersistenceService] - influxdb persistence service activated
2020-12-28 14:03:06.420 [DEBUG] [.internal.InfluxDBPersistenceService] - database status is OK, version is 1.8.3

This may be meaningful: I do NOT see this line in the openhab.log, as I have seen on other threads on the problem of OpenHab not pumping data into InfluxDB, for instance:

15:51:21.179 [DEBUG] [org.openhab.persistence.influxdb    ] - ServiceEvent REGISTERED - {org.openhab.core.persistence.PersistenceService, org.openhab.core.persistence.QueryablePersistenceService}={service.pid=org.openhab.influxdb, db

as if my influxdb bundle has not successfully registered to receive events?

I think you need to change

retentionPolicy=autogen

to

retentionPolicy=default

in influx.cfg

Try to change it like this:

Items {
    EnergyMeter_kwh* : strategy = everyChange
    Ws2902a_Temperature* : strategy = everyChange
    Laptop_power* : strategy = everyChange, everyMinute
}

This is for one individual item: EnergyMeter_kwh

This is for all items in a group called “EnergyMeter_kwh”: EnergyMeter_kwh*

No, this was changed a long time ago to autogen

It needs to be influxdb.cfg

1 Like

The influxdb.cfg says this in comment:

# The retention policy to be used, needs to configured in InfluxDB
# Till v0.13: 'default', since v1.0: 'autogen'
retentionPolicy=autogen

I’m running version 1.8.3:

$ influxd version
InfluxDB v1.8.3 (git: 1.8 563e6c3d1a7a2790763c6289501095dbec19244e)

Besides, it seems to me that the retention policy setting governs how long to retain data in influxdb and not how to get data INTO it.

Appended an asterisk to each item identifier and restarted the influxdb bundle, but it still doesn’t work.

2020-12-29 09:29:36.299 [DEBUG] [.InfluxDBPersistenceServiceActivator] - InfluxDB persistence bundle has been started.
2020-12-29 09:29:36.306 [DEBUG] [.internal.InfluxDBPersistenceService] - influxdb persistence service activated
2020-12-29 09:29:36.320 [DEBUG] [.internal.InfluxDBPersistenceService] - database status is OK, version is 1.8.3

It still seems meaningful that I don’t see this line in the openhab.log when influxdb bundle starts:

15:51:21.179 [DEBUG] [org.openhab.persistence.influxdb    ] - ServiceEvent REGISTERED - {org.openhab.core.persistence.PersistenceService, org.openhab.core.persistence.QueryablePersistenceService}={service.pid=org.openhab.influxdb, db

What happens if you put

auth-enabled = false

in your influxdb.conf? You need to restart influxdb service.

(That is the only idea I have since I moved to influxdb Version 2)

No, that can’t work because it is a group identifier, you would have to put all your items in that group.
Persisting individual items like you do without the asterisk is fine.

influxdb.conf: auth-enabled = false

didn’t make a difference.

Note that sine.py is able to pump data into influxdb.

Yes, I took out the asterisks again.

That does not help you if openHAB is not able to write data …