openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.86k stars 3.58k forks source link

[metrics] InfluxMetrics requires database user with admin privileges #11664

Closed alexf2015 closed 1 week ago

alexf2015 commented 2 years ago

I created a database "openhabmetrics" in influxdb and a user "openhabmetrics". I granted "all privileges" on "openhabmetrics" to that user so it can do anything in its own database but nothing else.

I configured metrics addon to use the user and database for influxdb storage. After restart of openhab I can see this error:

[ERROR] [icrometer.influx.InfluxMeterRegistry] - unable to create database 'openhabmetrics': {"error":"error authorizing query: openhabmetrics not authorized to execute statement 'CREATE DATABASE openhabmetrics', requires admin privilege"}
  1. I do not want to give maximum privileges to any user which should just write some data into the database
  2. The addon tries to create the database although it already exists
lsiepel commented 1 year ago

2. addon tries to create the database although it already exists

Did you get this sorted? Looks like the binding wans to create the databse when it is not available to the current logged in user. Probably some authorisation setting.

What if you grant full privileges just for the sake of inital creation? and restrict it afterwards? Just curious.

stale[bot] commented 6 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.