Influxdb and Grafana

Hi all,

Trying desperately to get to grips with persistence on OH, I’ve got mapdb now set up for my restoreonstartup but I’m now trying to install influxdb and grafana for previous states and some graphs etc.

So, I have openhabian on Rasp Pi 3, I’ve gone into the config file and seen that influx and Grafana are listed as options in the optional components section. I’ve clicked on it and follwoed the instructions to install them.

So far so good, I then go to follow the instructions on: here and, quite frankly, don’t get very far!

I type in influx and get the response that it is connected to the influx install but when I go to create the database as shown, I get the following error…

image

I wondered if the openhabian install already added the db so tried the use command as noted in the error, but no joy there…anyone else had any similar issues / got any ideas?

ERR: unable to parse authentication credentials

It looks like you need to provide a user/password for influxdb.
Example:

influx -username 'root' -password 'root'

This command shows you all databases:

SHOW DATABASES;

Thanks, I was going in as sudo su so assumed that trumped the other admin usernames but will try it this way :+1:

Why?
That’s a sure way of breaking something if you’re not careful

Advice: Use sudo line by line as required

It was only as a test to see if I could get this to work, it said about the authentication faiing so I though I’d just try it as ‘the boss’…it’s not my common practise…

1 Like

Hi,

Unfortunately the

influx -username 'root' -password 'root'

Didn’t work, I tried it with both admin and user options but got the same

ERR: unable to parse authentication credentials etc…

I have been googling around and there seems to be a few posts regarding influxdb / grafana not installing properly on openhabian via their config method but none seem to address my problem so I’m not sure whether to start again totally or i it’s all ok just a simple case of finding the correct method to log in…

Any ideas?

I don’t remember what openHABian sets as default.
Did you also try

influx -username 'openhab' -password '?openhab?'

I don’t know the default password.

Hi, yes, by default it sets up, (according to the setup), 2 users, admin and openhab…

I’ve tried both…no joy

openHABian Github
https://github.com/openhab/openhabian/blob/a8b7bd4c1760b7ad5bf839f9d3b55b0054e71ddd/docs/openhabian.md

{: #passwords}

User password needed for SSH or sudo (e.g. "openhabian:openhabian")
Samba share password (e.g. "openhabian:openhabian")
openHAB remote console (e.g. "openhab:habopen")
Amanda backup password (no default, applied when installing)
Nginx reverse proxy login (no default, applied when installing) For manual configuration see here.
InfluxDB (No password set by default)
Grafana visualization ("admin:admin")

strange, default points to no password

Checking Influx DOCS

Yes the install says something like ‘setting up user admin, please provide a password’, once entered the next screen then says, ‘setting up user openhab, please provide a password’

I’ve reinstalled it a few times to see if different passwords make a difference, the latest test was admin / admin and openhab / openhab

I have looked through the influx docs to see if there is something I’ve missed, the issue is it seems openhabian does most of the initial steps and create the users but I can’t seem to use them…

Did you try to disable http-auth in the config?
There was already someone with your issue

Maybe it’s really because of the host part. Try

influx -username 'admin' -password 'admin' -host localhost
1 Like

magic, I must have missed that thread in the search…I’ll give it a try tonight.

Thanks for you help so far!

Did you try with just a username and no password?

Right, a little update before I declare war on all things influx and grafana…

Not sure what I did but nothing worked until I stumbled across a post saying to do this

sudo chown -hR openhab:openhab /etc/openhab2
sudo chown openhab:openhabian /etc/openhab2/services/influxdb.cfg

I then found another post suggesting:

sudo nano /etc/influxdb/influxdb.conf

in the file under http you find:

auth-enabled = true

change this to false

Did that, and then when I just typed in $ influx it went in and I could follow the instructions:

CREATE DATABASE openhab_db
CREATE USER myusername WITH PASSWORD 'mypassword' WITH ALL PRIVILEGES
CREATE USER openhab WITH PASSWORD 'myopenhabpassword'
CREATE USER grafana WITH PASSWORD 'mygrafanapassword'
GRANT ALL ON openhab_db TO openhab
GRANT READ ON openhab_db TO grafana

The only thing that failed was the create user admin as there it said there is already an admin username.

My worry is that it hasn’t quite worked as I was expecting to be challenged with a username / password next time I tried to go to $influx but it just goes straight in…maybe I need to change the auth-enabled back to true now?

I’m now trying to set up grafana so I can see if the influx_db is working but when I go to openhabianpi:3000 and try to log in with the apparently default admin:admin username and password I get ‘invalid username or password’. I’ve tried all other ones I can think of and also purged grafana and reinstalled it from command line to see if that helps but no joy…

Any ideas?

1 Like

Note - Fixed it using

grafana-cli admin reset-admin-password

Logged into grafana in browser port 3000 and changed password again

Onwards…