lagusch
(Frank Haverbach)
December 31, 2016, 11:32am
1
Hello
I installed influxdb and grafana with the help of this tutorial. Everything runs very well but openhab doesnt write values into the created database openhab_db for the water item. With this script it works fine and i can see a nice sine wave in grafana.
influxdb.persist
Strategies {
everyHour : “0 0 * * * ?”
}
Items {
water : strategy = everyChange, everyHour
}
default.items
Number water “consumption: [%.1f m^3]” {mqtt=“<[rpi:home/ke/water:state:default]”}
default.sitemap
sitemap default label=“Main”
{
Frame label=“MQTT” {
Text item=water
}
}
The text item displays the correct value of the current water consumption.
Can anyone help?
hakan
(Hakan Tandogan)
December 31, 2016, 11:34am
2
Maybe not the proper solution, but the only way I could get influx to ever work was to persist all items into the database. Meaning:
* : strategy = everyChange, everyHour
This leads to a potentially huge influx database, but at least I have my data in it…
lagusch
(Frank Haverbach)
December 31, 2016, 11:42am
3
I changed my persistence file but nothing happens.
The database is still empty…
hakan
(Hakan Tandogan)
December 31, 2016, 11:47am
4
Could you perhaps enable logging of the influxdb by adding:
# influxdb logger
log4j.logger.org.openhab.persistence.influxdb = TRACE, influxdb, osgi:*
log4j.additivity.org.openhab.persistence.influxdb = false
# File appender - influxdb.log
log4j.appender.influxdb=org.apache.log4j.DailyRollingFileAppender
log4j.appender.influxdb.layout=org.apache.log4j.PatternLayout
log4j.appender.influxdb.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n
log4j.appender.influxdb.file=${openhab.logdir}/influxdb.log
log4j.appender.influxdb.DatePattern='.'yyyy-MM-dd
log4j.appender.influxdb.append=true
log4j.appender.influxdb.maxFileSize=10MB
log4j.appender.influxdb.maxBackupIndex=10
to your org.ops4j.pax.logging.cfg file and restarting openHAB?
This is not the most elegant way of enabling debugging but it helps on my system You might also want to read how increase logging:
http://docs.openhab.org/administration/logging.html
hakan
(Hakan Tandogan)
December 31, 2016, 11:48am
5
Also, I have the following in my influxdb.cfg:
#
# See
# https://community.openhab.org/t/influxdb-grafana-persistence-and-graphing/13761/62?u=hakan
#
# retentionPolicy=autogen
retentionPolicy=default
#
perhaps this might help too…
sihui
(SiHui)
December 31, 2016, 12:35pm
6
Groups worked fine for me:
Group gInfluxdb // for Items to preserve history or to persist charting
Number Temperature "Temperatur [%.1f °C]" (gInfluxdb) { mqtt="<[mosquitto:/esp8266four/temperature/shadow:state:default]" }
Strategies {
default = everyUpdate
}
Items {
gInfluxdb* : strategy = everyChange, restoreOnStartup
}
Bajuware
(R. R.)
February 3, 2017, 9:11pm
7
Maybe this is the issue:
I always had this errormessage in the openhab.log
2017-02-03 21:31:00.173 [ERROR] [i.i.InfluxDBPersistenceService] - database error: {"error":"retention policy not found: default"}
This is because there was a change in influxdb for new builds.
The default retention policy is now “autogen” and not “default”.
See here:
[https://github.com/openhab/openhab1-addons/wiki/InfluxDB-Persistence ]
> show retention policies on openhab
name duration shardGroupDuration replicaN default
---- -------- ------------------ -------- -------
autogen 0s 168h0m0s 1 false
Now i create a second policy and it works.
CREATE RETENTION POLICY "default" ON "openhab" DURATION 0s REPLICATION 1 DEFAULT