[SOLVED] MQTT & influx, no datapoints in grafana

openhab2
mqtt
items
Tags: #<Tag:0x00007fe05dbf9f88> #<Tag:0x00007fe05dbf9c90> #<Tag:0x00007fe05dbf99c0>

(Arne) #1

So… somehow i was able to create a influx database ( am not realy able to get to the CLI with the command influxd…(see last post in The Influx grafana Tutorial )
Anyway somehow i was able to create a openhab_db and grafena is also able to communicate with this DB
Yeah!

Now i want to save some values in that Database.

I have a esp sending temperature values to a MQTT Server and i am able to see the values as a generic MQTT thing.

I have a MQTT Broker, a Generic MQTT Thin (Subscripted to a channel (mqtt:topic:48450fd7:temperature) and i have an item named temperature linked to GenericMQTTThing_Temperature (which i can see in the Control Tab)

what do i have to write in my influxdb.persist-file?

I tried the name of the item like this

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

Items {
temperature*: strategy = everyMinute
}

But in grafana i just get the feedback that no datapoints are available?
So what to i have exactly to write in my persistence file?

Thanks in advance.


(Jürgen Baginski) #2

If your item is named temperature the “temperature*” in the .persist file ( which should be a group) is not correct. Remove the “*” and it should work.


(Arne) #3

I deleted the “*” but still get no datapoints :frowning:


(Vincent Regaud) #4

What do you have in your influxdb.cfg in your services folder?


(Arne) #5

beside the comments i have got this in the influxdb.cfg

 url=http://localhost:8086
user=iwonttellyou
password=iwonttellyou
db=openhab_db
retentionPolicy=autogen

(John Schmitz) #6

at the command line, type “influx”. Then, at the ‘>’ prompt, type in:

auth - will ask for your user name and password
use openhab_db
show measurements
Your measurement should be listed. If it is there, type:
select * from measurement (change name as needed)
You should then see your measurements.

If you don’t see your measurement, then it is not getting into influxdb. By default, influx does write logging to /var/log/syslog. Look there to see if you have any influx log information. You should see one log entry every time your item is persisted.

Also, in Grafana, when you set up your graph, be sure to select the retention policy of ‘autogen’ since that is what you are using. Grafana can be confusing - it will show the measurement as available even if you have the wrong retention policy, but it will show no points on your graph. So make sure to set the retention policy there (assuming that the above works and that you are getting data into influxdb).


(Arne) #7

what went wrong when the influx command is not known and i can only start something with influxd?

The syslog says that something about permission denied

Feb 10 19:18:04 openHABianPi influxd[539]: [write] 2019/02/10 19:18:04 write failed for shard 1: [shard 1] open /var/lib/influxdb/wal/_internal/monitor/1/_00004.wal: permission denied
Feb 10 19:18:04 openHABianPi influxd[539]: [monitor] 2019/02/10 19:18:04 failed to store statistics: [shard 1] open /var/lib/influxdb/wal/_internal/monitor/1/_00004.wal: permission denied

(SiHui) #8

Double check your setup:

$ influx
Connected to http://localhost:8086 version 0.13
InfluxDB shell version: 0.13
> CREATE DATABASE openhab_db
> CREATE USER admin WITH PASSWORD 'SuperSecretPassword123+' WITH ALL PRIVILEGES
> CREATE USER openhab WITH PASSWORD 'AnotherSuperbPassword456-'
> CREATE USER grafana WITH PASSWORD 'PleaseLetMeRead789?'
> GRANT ALL ON openhab_db TO openhab
> GRANT READ ON openhab_db TO grafana
> exit

(Arne) #9

Hmm ok,
i see that the installation of Influx aborted with

 2019-02-10 19:39:44,865: FireMotD: Error: Template folder doesn't exist. Upgrading from an older version? Please run make again or run the install function "FireMotD -I -v".

i did the workaround according this.
removed and reinstall influx. but still the influx command is unknown…


(Arne) #10
systemctl status influxdb.service -l

delivers this text:

 influxdb.service - InfluxDB is an open-source, distributed, time series database
   Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-02-10 19:49:35 CET; 34min ago
     Docs: man:influxd(1)
 Main PID: 9209 (influxd)
   CGroup: /system.slice/influxdb.service
           └─9209 /usr/bin/influxd -config /etc/influxdb/influxdb.conf

Feb 10 19:49:36 openHABianPi influxd[9209]: [admin] 2019/02/10 19:49:36 Starting admin service
Feb 10 19:49:36 openHABianPi influxd[9209]: [monitor] 2019/02/10 19:49:36 Storing statistics in database '_internal' retention
Feb 10 19:49:36 openHABianPi influxd[9209]: [admin] 2019/02/10 19:49:36 Listening on HTTP: [::]:8083
Feb 10 19:49:36 openHABianPi influxd[9209]: [continuous_querier] 2019/02/10 19:49:36 Starting continuous query service
Feb 10 19:49:36 openHABianPi influxd[9209]: [httpd] 2019/02/10 19:49:36 Starting HTTP service
Feb 10 19:49:36 openHABianPi influxd[9209]: [httpd] 2019/02/10 19:49:36 Authentication enabled: false
Feb 10 19:49:36 openHABianPi influxd[9209]: [httpd] 2019/02/10 19:49:36 Listening on HTTP: [::]:8086
Feb 10 19:49:36 openHABianPi influxd[9209]: [retention] 2019/02/10 19:49:36 Starting retention policy enforcement service with
Feb 10 19:49:36 openHABianPi influxd[9209]: [run] 2019/02/10 19:49:36 Listening for signals
Feb 10 20:19:36 openHABianPi influxd[9209]: [retention] 2019/02/10 20:19:36 retention policy shard deletion check commencing
lines 1-18/18 (END)
● influxdb.service - InfluxDB is an open-source, distributed, time series database
   Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-02-10 19:49:35 CET; 34min ago
     Docs: man:influxd(1)
 Main PID: 9209 (influxd)
   CGroup: /system.slice/influxdb.service
           └─9209 /usr/bin/influxd -config /etc/influxdb/influxdb.conf

Feb 10 19:49:36 openHABianPi influxd[9209]: [admin] 2019/02/10 19:49:36 Starting admin service
Feb 10 19:49:36 openHABianPi influxd[9209]: [monitor] 2019/02/10 19:49:36 Storing statistics in database '_internal' retention policy 'monit
Feb 10 19:49:36 openHABianPi influxd[9209]: [admin] 2019/02/10 19:49:36 Listening on HTTP: [::]:8083
Feb 10 19:49:36 openHABianPi influxd[9209]: [continuous_querier] 2019/02/10 19:49:36 Starting continuous query service
Feb 10 19:49:36 openHABianPi influxd[9209]: [httpd] 2019/02/10 19:49:36 Starting HTTP service
Feb 10 19:49:36 openHABianPi influxd[9209]: [httpd] 2019/02/10 19:49:36 Authentication enabled: false
Feb 10 19:49:36 openHABianPi influxd[9209]: [httpd] 2019/02/10 19:49:36 Listening on HTTP: [::]:8086
Feb 10 19:49:36 openHABianPi influxd[9209]: [retention] 2019/02/10 19:49:36 Starting retention policy enforcement service with check interva
Feb 10 19:49:36 openHABianPi influxd[9209]: [run] 2019/02/10 19:49:36 Listening for signals
Feb 10 20:19:36 openHABianPi influxd[9209]: [retention] 2019/02/10 20:19:36 retention policy shard deletion check commencing
~
~
~
~
~


(John Schmitz) #11

It’s possible that the client isn’t installed. Try this:

sudo apt-install influxdb-client

After this, influx should be there as /usr/bin/influx
It does look like influxdb is running correctly. If you wait a while, do you see any entries for the writes?

Feb 10 15:35:00 chelan-nuc influxd[23460]: [httpd] 192.168.86.212 - openhab [10/Feb/2019:15:35:00 -0800] "POST /write?consistency=one&db=openhab_db&p=%5BREDACTED%5D&precision=n&rp=rp_1month&u=openhab HTTP/1.1" 204 0 "-" "okhttp/2.4.0" 7b60c94f-2d8c-11e9-961d-000000000000 2367

Those are the writes to the database from openHAB.


(Arne) #12

i tried this one

sudo apt-get install influxdb-client
E: Type '“deb' is not known on line 1 in source list /etc/apt/sources.list.d/influxdb.list
E: The list of sources could not be read.
E: Type '“deb' is not known on line 1 in source list /etc/apt/sources.list.d/influxdb.list
E: The list of sources could not be read.

apt-install is an unknown command on my pi

Any ideas?


(Arne) #13

Ok, this becomes really annoying…

Influx seem to work (since the status command is delivering something)
i am able to connect to the influx command line interface via webinterface (localhost.8083),
i can write some data into the influx database using the webinterface.
I can make some graphs via grafana using this manual written data.

But openhab refuses to write the parameter temperature into the influx database.


(SiHui) #14

Authentication problem?
Try

edit /etc/influxdb/influxdb.conf
auth-enabled = false


(Arne) #15

the one under http? I guess there is only that one. It is already false.

Edit: i checked now every config file of everything, and i guess the only thing which i can do now is to start from the scratch again.

I’ll flash a new openhab image tomorrow


(John Schmitz) #16

Look at the /var/log/syslog after a write to InfluxDB should have occurred. You should see something like this indicating a POST write. If you are not getting a POST line, then the issue is with openHAB not writing at all. If you see httpd POST lines from InfluxDB in the syslog, but they are not successful, then that needs to be debugged. The ‘204’ below indicates success.

Feb 10 15:35:00 chelan-nuc influxd[23460]: [httpd] 192.168.86.212 - openhab [10/Feb/2019:15:35:00 -0800] "POST /write?consistency=one&db=openhab_db&p=%5BREDACTED%5D&precision=n&rp=rp_1month&u=openhab HTTP/1.1" 204 0 "-" "okhttp/2.4.0" 7b60c94f-2d8c-11e9-961d-000000000000 2367

(Arne) #17

naa… the latest status is that i do not get any entries that indicates a post , so yes obvious it is somehow related to openhab which is not willing to write the data (probably because i miss some commands)


(John Schmitz) #18

Your item’s name is temperature? Maybe you want this without the ‘*’. That’s the way I read it here. Also, you have installed the InfluxDB persistence service?

Items {
  temperature: strategy = everyMinute
}

(Jürgen Baginski) #19

The “" would indicate the name is a group. If it is an Item do not use the "”.


(Arne) #20

currently it looks like this:


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

Items {
temperature : strategy = everyMinute
}

but i have some spare minutes right now. So i will reset the complete Pi.