Influxdb: no data in db

Hi,
I’m trying to get persistence with influxdb working. So far no data ends up in the database (SHOW MEASUREMENTS returns nothing). The logs seems normal.
I might be overlooking something.

Any suggestions would be appreciated.
Thanks.

Openhab 1.8.2 running on a RP with Jessie minimal
Files in addons folder:
org.openhab.binding.dsmr-1.8.2.jar
org.openhab.binding.iec6205621meter-1.8.2.jar
org.openhab.binding.zwave-1.8.2.jar
org.openhab.io.habmin-1.7.0-SNAPSHOT.jar
org.openhab.persistence.influxdb-1.8.2.jar

openhab.cfg:
############################ InfluxDB Persistence Service #############################
influxdb:url=http://localhost:8086
influxdb:user=openhab
influxdb:password=openhab
influxdb:db=openhab

influxdb.persist:
Strategies {
everyHour : "0 0 * * * ?"
everyDay : "0 0 0 * * ?"
everyMinute : "0 * * * * ?"
default = everyMinute
}

Items {
P1_eDeliveryTariff1 : strategy = everyChange
}

openhab log:
2016-04-18 09:34:51.315 [DEBUG] [xDBPersistenceServiceActivator] - InfluxDB persistence bundle has been started.
2016-04-18 09:34:51.478 [DEBUG] [i.i.InfluxDBPersistenceService] - influxdb persistence service activated
2016-04-18 09:34:53.907 [DEBUG] [i.i.InfluxDBPersistenceService] - database status is OK, version is 0.12.1
2016-04-18 09:35:01.205 [TRACE] [i.i.InfluxDBPersistenceService] - Tried to get item from item class class org.openhab.core.library.items.NumberItem, state is 4492.9609375
2016-04-18 09:35:01.208 [TRACE] [i.i.InfluxDBPersistenceService] - found fractional part
2016-04-18 09:35:01.211 [DEBUG] [i.i.InfluxDBPersistenceService] - got DecimalType value 4492.9609375
2016-04-18 09:35:01.214 [TRACE] [i.i.InfluxDBPersistenceService] - storing P1_eDeliveryTariff1 in influxdb value 4492.9609375, P1_eDeliveryTariff1 (Type=NumberItem, State=4492.9609375)

influxdb log:
[http] 2016/04/18 12:53:19 127.0.0.1 - - [18/Apr/2016:12:53:19 +0200] GET /ping HTTP/1.1 204 0 - okhttp/2.4.0 c2fa64bf-0553-11e6-8001-000000000000 256.925µs
[http] 2016/04/18 12:53:25 127.0.0.1 - openhab [18/Apr/2016:12:53:25 +0200] POST /write?consistency=one&db=openhab&p=%5BREDACTED%5D&precision=n&rp=default&u=openhab HTTP/1.1 204 0 - okhttp/2.4.0 c6f69cb1-0553-11e6-8002-000000000000 9.829572ms

Hi There,

I got the same Problem with InfluxDB 0.13.0.

First I thought that there might be an error with the DB - but then I enabled the trace log of the influxdb persistance service. It told me, that data was written successfully.

And now the crazy shit: The InfluxDB Server doesn’t receive any request - not even a network request (checked with tcpdump). So there seems to be a problem with the persistence plugin - but how to fix this?

Bests
Pascal

I will check this within the next days.

1 Like

If you need further information feel free to contact me.

Hi, unfortunatelly I have the same issue.

I have installed Openhab and Inluxdb on a RasPi 2.
I use Openhab 1.8.3 and the corresponding influxdb addon.
I installed the v0.13 influxdb ARM .deb package from the influxdata download page. I haven’t touched the influxdb.cfg file, that means the default config is used.

I see the same messages as the initial poster coyote and no data is stored in the database.

Does anyone have any idea what I could do to narrow down the problem?

Thanks.

I think I have found something. If you look at coyote’s post, in the last line, you see the POST request to the /write endpoint. There you can see that the request includes “rp=default”.

However, I defined for my openhab database a different retention policy, called openhab_retention and set this as the default policy.

So playing around with curl I noticed that if the POST request contains the “rp=” parameter to a retention policy which is not the default policy for the specified database, then nothing is written into the database.

So I’m not sure if this is a bug in influxdb or if openhab (or the influxdb persistance addon) does not use influxdb’s http api correctly.

However, it would be nice if somehow, the retention policy, which is submitted from openhab to influxdb via the POST request could be changed in a config file.

Can anyone think of a quick fix for this issue? … ok apart of using only the “default” retention policy in influxdb.

Cheers

Unfortunately until now a didn’t find the time to check this issue. I haven’t tested it yet but build the influxdb binding with the latest influxdb java api jar. It would be great if someone could test if this solves the issues. The plugin is available from here: https://bintray.com/theoweiss/generic/download_file?file_path=6%2Forg.openhab.persistence.influxdb-1.9.0-SNAPSHOT.jar

Regards,
Theo

I’ve been busy on and off to get this working. It is now running fine with

org.openhab.persistence.influxdb-1.8.2.jar

openhab.cfg

persistence:default=influxdb

influxdb:url=http://localhost:8086
influxdb:user=openhab
influxdb:password=openhab
influxdb:db=openhab

influxdb.persist
Strategies {

everyHour 	: "0 0 * * * ?"
everyDay  	: "0 0 0 * * ?"
everyMinute : "0 * * * * ?"
every5Min 	: "0 */5 * * * ?"
every5Sec 	: "*/5 * * * * ?"

 // if no strategy is specified for an item entry below, the default list will be used
default = every5Min

}

Items {
PH_heat,PH_vol : strategy = every5Min, restoreOnStartup
E_IN,E_OUT,E_PRD,E_CON,P_IN,P_OUT,P_PRD : strategy = every5Min, restoreOnStartup
E_IN_DAILY,E_OUT_DAILY,E_PRD_DAILY,E_CON_DAILY,E_CON_MIDNIGHT : strategy = every5Min, restoreOnStartup
swc_4_Power,swc_4_Energy : strategy = every5Sec, restoreOnStartup
}

Hi theo

unfortunately, the 1.9.0. snapshot does not work either.

I still think that the origin of the problem is caused by openhab specifying/setting the retention policy in the POST request to “default”.

I checked InfluxDBPersistenceService.java and if I understand the code correctly, then, I see two issues there.

  1. there is no possibility for the user to specify a retention policy, since the “activate” method only parses for the attributes (user, password, db and url).
  2. in the “store” method, when influxDB.write is called, the retention policy is hard-coded as “default”.

So I think either there should be a way to change the name of the retention policy via openhab.cfg or perhaps the persistence service should just avoid using it.

cheers

Hi @atza,

this snapshot allows to configure the retention policy, just add influxdb:retentionPolicy=mypolicy to openhab.cfg:
https://bintray.com/theoweiss/generic/download_file?file_path=7%2Forg.openhab.persistence.influxdb-1.9.0-SNAPSHOT.jar

Could you please test this snapshot again?

Thanks,
Theo

Hi @theo,

thanks a lot for the quick response and a new snapshot.
Thanks to your modification I was able to change the retention policy name and now I see that values are populated/written in database.

This modification fixes the problem!!! - at least in my case. :+1:

BTW, it’s somewhat off-topic, and I not sure if you are the right person to address this finding. While I was tracing the tcp communication, I saw that in the POST request, which is coming from openhab/influxdb addon, there is perhaps an obsolete parameter. The POST request contains “consistency=one”, however I could find this parameter in the latest v0.13 influxdb HTTP API.

Once again, excellent work with the retention policy and I look forward having it in the next openhab release :smiley:

cheers

Just for completeness: In my case, the user accessing the Database didn’t have the permission to write to the database. But the log files didn’t report any connection error.

Where do I find the log?