[SOLVED] MQTT & influx, no datapoints in grafana

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

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

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

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).

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

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

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…

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
~
~
~
~
~

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.

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?

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.

Authentication problem?
Try

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

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

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

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)

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
}

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

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.

Can you post this item config, please?

2 Likes

oh wait…
eeehm , where can i find it? the items folder is empty.

Here is a screenshot

You can only persist the state of items, your item-Name is NOT “temperature” as can be be seen in the screenshot! The item-Name to be persited is “GenericMQTTThing_Temperature”!
@vzorglub: Good catch! (This “solved” goes on your account!)

1 Like