Boerderij / Varken

Standalone application to aggregate data from the Plex ecosystem into InfluxDB using Grafana as a frontend
MIT License
1.14k stars 134 forks source link

[Feature Request] Support for InfluxDB 2.0 #159

Open lesteenman opened 4 years ago

lesteenman commented 4 years ago

Is your feature request related to a problem? Please describe. I want to use Varken with an instance of InfluxDB cloud, rather than using a locally hosted instance. This currently runs on version 2.0, and I expect that the project will want to connect to the newer version at some point in the future anyway.

Describe the solution you'd like An option in the configuration to use the InfluxDB 2.0 API. The main difference I can see from the user side is that it uses api tokens rather than a username and password.

Describe alternatives you've considered I've considered either hosting a 1.0 database myself, or copying the Radarr/Sonarr/Tautulli scripts from Varken and using them in my own project. However, I want to try to add support for the 2.0 client in Varken itself, if this is something you would want upstream.

lesteenman commented 4 years ago

An alternative option would, of course, be to use an InfluxDB instance specifically for Varken. How intended is it to use your own, general InfluxDB account vs using one specifically for Varken?

dirtycajunrice commented 4 years ago

Will always take a look at PRs!

afriberg commented 4 years ago

Any update regarding this feature?

PrivatePuffin commented 3 years ago

@afriberg It's an insane amount of work, so isn't going to happen any time soon (tm) (And that can be said for all ofther projects where people are asking this too)

samwiseg0 commented 3 years ago

After doing some research it looks like we will have to rewrite the DB module to use this project instead. https://github.com/influxdata/influxdb-client-python

Nicras commented 3 years ago

Hi, it would be nice if anyone could merge the pull request, so that we can start using influxdb2 with Varken. Thanks in advance

dirtycajunrice commented 3 years ago

@Nicras I have not had the time to walk through this MR. I will try to make it a priority this evening.

Nicras commented 3 years ago

@DirtyCajunRice I guess there were other things with higher priority that evening xD It would be very cool, if you could have a look anytime soon. I had to upgrade to influxDB V2 and since then my Dashboard looks weird

tedtms commented 3 years ago

@DirtyCajunRice bumping since this thread is getting old -- any news on getting @Nicras's pull request merged?

Thanks a ton! Ted

tedtms commented 3 years ago

Bumping again. Is there anything keeping Nicra's pull request from being merged?

samwiseg0 commented 3 years ago

Bumping again. Is there anything keeping Nicra's pull request from being merged?

Yes, several things. We are contemplating only supporting certain modules that don't have off the shelf exporters which means a rewrite for 2.0 and parking the current version for 1.8.x only.

If you direly need 2.0 support then you can run their fork for now.

tedtms commented 3 years ago

@samwiseg0 thanks for the update! I'll probably do that for the time being.

hansaya commented 3 years ago

As a workaround, you can create a old style db under a bucket and create user/pass for it.

Get into influx CLI and get the list of buckets. If you dont have a bucket then create one. influx bucket list -o <your org> -t <admin token>

Use the bucket id to create a db influx v1 dbrp create --db varken --rp varken-rp --bucket-id <bucket-id> --default -o <your org> -t <admin token>

Create a user/pass. This call will prompt you for a password influx v1 auth create --read-bucket <bucket-id> --write-bucket <bucket-id> --username varken-user -o <your org> -t <admin token>

Then use that info on the config

[influxdb]
url = <host>
port = 8086
ssl = false
verify_ssl = false
username = varken-user
password = <password>
Jleagle commented 2 years ago

Tried to give this workaround a try and while it can connect fine it does some automation that crashes.

2022-03-03 15:46:07 : DEBUG : connectionpool : Starting new HTTP connection (1): influx:8086
2022-03-03 15:46:07 : DEBUG : connectionpool : http://influx:8086 "GET /ping HTTP/1.1" 204 0
2022-03-03 15:46:07 : INFO : dbmanager : Influxdb version: 2.1.1, 2.1.1
2022-03-03 15:46:07 : DEBUG : connectionpool : http://influx:8086 "GET /query?q=SHOW+DATABASES&db=varken HTTP/1.1" 200 106
2022-03-03 15:46:07 : INFO : dbmanager : Creating varken database
2022-03-03 15:46:07 : DEBUG : connectionpool : http://influx:8086 "POST /query?q=CREATE+DATABASE+%22varken%22&db=varken HTTP/1.1" 200 76
Traceback (most recent call last):
  File "/app/Varken.py", line 93, in <module>
    DBMANAGER = DBManager(CONFIG.influx_server)
  File "/app/varken/dbmanager.py", line 29, in __init__
    self.influx.create_database('varken')
  File "/usr/local/lib/python3.9/site-packages/influxdb/client.py", line 578, in create_database
    self.query("CREATE DATABASE {0}".format(quote_ident(dbname)),
  File "/usr/local/lib/python3.9/site-packages/influxdb/client.py", line 424, in query
varken                    |     results = [
  File "/usr/local/lib/python3.9/site-packages/influxdb/client.py", line 425, in <listcomp>
    ResultSet(result, raise_errors=raise_errors)
  File "/usr/local/lib/python3.9/site-packages/influxdb/resultset.py", line 25, in __init__
    raise InfluxDBClientError(self.error)
influxdb.exceptions.InfluxDBClientError: not implemented: CREATE DATABASE

Maybe a config option to disable checking if database exists and creating a new database automatically?