[SOLVED] [Influx+grafana] Struggling with influx


(nitrogaute) #1

Hi, I´m really struggling with the influx database. I´m running openhabian on a RP3+ setup. I have just reinstalled Openhab, because I thought I had poluted the installation with all my trial and errors. So I have followed this tutorial: https://community.openhab.org/t/influxdb-grafana-persistence-and-graphing/13761
But I used the openhabian-config to install influx+grafana.

When the tutorial states to

sudo systemctl restart influxdb.service

I get the following response:

 **[23:24:29]** **openhabian@openHABianPi** : **~** $ systemctl restart influxdb.service

**==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===**

Authentication is required to restart 'influxdb.service'.

Authenticating as: root

Password: Failed to restart influxdb.service: Connection timed out

See system logs and 'systemctl status influxdb.service' for details.

polkit-agent-helper-1: pam_authenticate failed: Authentication failure

And I have no clue what the “root” password is. I´ve tried everything.

Also when i try to stop the openhab service, I get:

[00:04:53] openhabian@openHABianPi:~$ sudo systemctl stop openhab2.service 
[sudo] password for openhabian: 
Failed to stop openhab2.service\xc2\xa0.service: Unit openhab2.service\xc2\xa0.service not loaded.

That last one worked just fine before I installed influx+grafana.
In addition, or relateded, to this I can´t get any entries into my influx databased. I tried following the rest of the tutorial and the rest seems to work. Forced entries in influx will read back in grafana etc.

● 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 2018-11-25 23:20:16 CET; 28min ago
     Docs: https://docs.influxdata.com/influxdb/
 Main PID: 526 (influxd)
   CGroup: /system.slice/influxdb.service
           └─526 /usr/bin/influxd -config /etc/influxdb/influxdb.conf

Nov 25 23:23:02 openHABianPi influxd[526]: [httpd] ::1 - - [25/Nov/2018:23:23:02 +0100] "POST /query?db=&epoch=ns&q=SHOW+DATABASES HTTP/1.1" 200 121 "-" "InfluxDBShell/1.7.1" ac5a7c1a-f100-11e8-8002-b827ebce645
Nov 25 23:23:07 openHABianPi influxd[526]: ts=2018-11-25T22:23:07.359962Z lvl=info msg="Executing query" log_id=0B~FBvtG000 service=query query="SELECT \"key\" FROM openhab_db.autogen._series"
Nov 25 23:23:07 openHABianPi influxd[526]: [httpd] ::1 - - [25/Nov/2018:23:23:07 +0100] "POST /query?chunked=true&db=openhab_db&epoch=ns&q=show+series HTTP/1.1" 200 57 "-" "InfluxDBShell/1.7.1" af075ccd-f100-11
Nov 25 23:23:49 openHABianPi influxd[526]: [httpd] ::1 - - [25/Nov/2018:23:23:49 +0100] "POST /query?chunked=true&db=openhab_db&epoch=ns&q=systemctl+restart+influxdb.service HTTP/1.1" 400 154 "-" "InfluxDBShell
Nov 25 23:36:35 openHABianPi influxd[526]: [httpd] ::1 - - [25/Nov/2018:23:36:35 +0100] "GET /ping HTTP/1.1" 204 0 "-" "InfluxDBShell/1.7.1" 909c8bf8-f102-11e8-8005-b827ebce6459 148
Nov 25 23:36:45 openHABianPi influxd[526]: [httpd] ::1 - - [25/Nov/2018:23:36:45 +0100] "GET /ping HTTP/1.1" 204 0 "-" "InfluxDBShell/1.7.1" 9686469d-f102-11e8-8006-b827ebce6459 124
Nov 25 23:36:51 openHABianPi influxd[526]: ts=2018-11-25T22:36:51.387024Z lvl=info msg="Executing query" log_id=0B~FBvtG000 service=query query="SHOW DATABASES"
Nov 25 23:36:51 openHABianPi influxd[526]: [httpd] ::1 - - [25/Nov/2018:23:36:51 +0100] "POST /query?db=&epoch=ns&q=SHOW+DATABASES HTTP/1.1" 200 121 "-" "InfluxDBShell/1.7.1" 9a2feb2d-f102-11e8-8007-b827ebce645
Nov 25 23:36:56 openHABianPi influxd[526]: ts=2018-11-25T22:36:56.983948Z lvl=info msg="Executing query" log_id=0B~FBvtG000 service=query query="SELECT \"key\" FROM openhab_db.autogen._series"
Nov 25 23:36:56 openHABianPi influxd[526]: [httpd] ::1 - - [25/Nov/2018:23:36:56 +0100] "POST /query?chunked=true&db=openhab_db&epoch=ns&q=show+series HTTP/1.1" 200 57 "-" "InfluxDBShell/1.7.1" 9d85fc68-f102-11

From the influx console:

[00:05:22] openhabian@openHABianPi:~$ influx
Connected to http://localhost:8086 version 1.7.1
InfluxDB shell version: 1.7.1
Enter an InfluxQL query
> use openhab_db
Using database openhab_db
> show series
> 

Logviewer frontail:

2018-11-25 23:21:16.556 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'influxdb.persist'

2018-11-25 23:21:46.402 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'tradfri:gateway:gwb8d7af2be3a7' to inbox.

2018-11-25 23:22:27.860 [DEBUG] [org.openhab.persistence.influxdb    ] - BundleEvent STARTING - org.openhab.persistence.influxdb

2018-11-25 23:22:27.870 [DEBUG] [.InfluxDBPersistenceServiceActivator] - InfluxDB persistence bundle has been started.

2018-11-25 23:22:27.877 [DEBUG] [org.openhab.persistence.influxdb    ] - BundleEvent STARTED - org.openhab.persistence.influxdb

I think my issue has to do with permissions or that some path has been changed due to influx installation. Any ideas?


(Angelos) #2

you should use sudo when performing this kind of tasks
or switch permanently to root using: sudo su
then you can change the root password if you would like with passwd

what are these extra characters ? :slight_smile:

switch to root and try again:

sudo su
systemctl status openhab2

(nitrogaute) #3

Thank you. That enabled me to get through with those commands. But the problem in hand still persists…
I still can´t get influx to pick up any data.

See my /etc/openhab2/persistence/influxdb.persist

Strategies {
    everyMinute : "0 * * * * ?"
    everyHour   : "0 0 * * * ?"
    everyDay    : "0 0 0 * * ?"
}

Items {
    * : strategy = everyChange, everyHour
    XiaomiMiTemperatureHumiditySensor3_Temperature : strategy = everyMinute
}

And my /etc/openhab2/services/influxdb.cfg

# The database URL, e.g. http://127.0.0.1:8086 or https://127.0.0.1:8084 .
# Defaults to: http://127.0.0.1:8086
# url=http(s)://10.0.1.17:8086

# The name of the database user, e.g. openhab.
# Defaults to: openhab
# user=openhab

# The password of the database user.
# password=secret_pass

# The name of the database, e.g. openhab.
# Defaults to: openhab
# db=openhab_db

Any logging i can do or advice on how to troubleshoot this further?


(Angelos) #4

all config parameters are commented out or this is a typo?

url=http://127.0.0.1:8086
user=<username>
password=<password>
db=openhab_db
retentionPolicy=autogen

You should already have authentication errors being logged in your /var/log/openhab2/openhab.log since the defaults in influxdb.cfg are not going to work for you)


(nitrogaute) #5

Thank you so much! I totally failed to see the obvious here! Now everything works! Thanks again!