Influxdb2 (#3)

* #203

* Update docker compose to specify influxdb:1.8.4

* Update requirements to use urllib3==1.26.5

* updated to support Radarr and Sonarr V3 Api

* bump requirements for requests

* Fix Sonarr & Radarr V3 API /queue endpoint (#220)

* Fix lint issues

* More lint fixes

* Update Sonarr structures

* Add Overseerr Support (#210)

* Remove duplicate structures

* update changelog to reflect v1.7.7 changes

* Add IP data to tautulli #202

* add missing ip address in tautulli

* Fixed: Streamlined API calls to Radarr and Sonarr (#221)

* Fixed: Sonarr Data pull issues (#222)

* Fix Sonarrr calendar

* Update lidarr structure (#225)

Added missing arguments to Lidarr structure

Fixes #223

* Clean up request totals. Upstream change sct/overseerr#2426

* Cleanup blank space

* Fix requested_date syntax.

* Fix requested_date for Overseerr tv and movie

* Fix overseerr config refernces

* Fix overseerr structures

* Update intparser to accommodate changes to config structure

* Cleanup overseerr data collection

* Fix SERVICES_ENABLED in varken.py to acomidate overseerr

* Fixed: Sonarr/Lidarr Queues (#227)

* Change sonarr queue structures to str

* Fixed: Multipage queue fetching

* Update historical tautulli import (#226)

* Fixed: Sonarr perams ordering

* Fixed: Proper warnings for missing data in sonarr and radarr

* Added: Overseerr ENVs to docker compose.

* Added: Logging to empty/no data returns

* Update Sonarr & Lidarr Structs to match latest API changes (#231)

* Add support for estimatedCompletionTime in LidarrQueue

* Add support for tvdbId in SonarrEpisode struct

* Fix typo in docker yml

* Rename example url for overseerr in docker yml

* Update radarr structures to inclue originalLanguage

* Update radarr structures to include addOptions

* Update radarr structures to include popularity

* fix(ombi): Update structures.py (#238)

* feat(docker): remove envs from example

* fix(logging): remove depreciation warning. Var for debug mode (#240)

* fix(build): bump schedule version to 1.1

* fix(build): bump docker python version

* fix(dep): update requests and urllib3

* fix(sonarr): ensure invalid sonarr queue items are just skipped over - fixes #239 (#243)

* add branch to build inputs

* update pipeline badge

* Update automation

* Add influxdb 2 client

* Add structure for influxdb 2 params

This contains all the data needed for connecting and writing to an InfluxDB2 server

* Parse influxdb 2 config data

* Add influxdb2 manager class

This stores the data needed for InfluxDB2, and has a single `write_points` function on this that takes an array of points to add to the database

* Use the correct db manager for varken

* Add influxdb2 to the example varken config file

* Create influx bucket if it doesn't exist

* Update InfluxDB type on README

* Clean up linting errors

* Wrap create bucket in try/catch

* Use bucket given in ini file

* Log exception to troubleshoot errors

* Allow configured influx2 address as URL (no port)

* Bypass validity check to troubleshoot

---------

Co-authored-by: mal5305 <malcolm.e.rogers@gmail.com>
Co-authored-by: samwiseg0 <2241731+samwiseg0@users.noreply.github.com>
Co-authored-by: Robin <19610103+RobinDadswell@users.noreply.github.com>
Co-authored-by: tigattack <10629864+tigattack@users.noreply.github.com>
Co-authored-by: Stewart Thomson <stewartthomson3@gmail.com>
Co-authored-by: Cameron Stephen <mail@cajs.co.uk>
Co-authored-by: MDHMatt <10845262+MDHMatt@users.noreply.github.com>
Co-authored-by: Nathan Adams <dinnerbone@dinnerbone.com>
Co-authored-by: Nicholas St. Germain <nick@cajun.pro>
Co-authored-by: Gabe Revells <gcrevell@mtu.edu>
This commit is contained in:
d-mcknight 2023-06-22 21:58:21 -07:00 committed by GitHub
parent b5a83f0d34
commit 7e03144365
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 578 additions and 194 deletions

View file

@ -9,7 +9,7 @@ from configparser import ConfigParser, NoOptionError, NoSectionError
from varken.varkenlogger import BlacklistFilter
from varken.structures import SickChillServer, UniFiServer
from varken.helpers import clean_sid_check, rfc1918_ip_check, boolcheck
from varken.structures import SonarrServer, RadarrServer, OmbiServer, TautulliServer, InfluxServer
from varken.structures import SonarrServer, RadarrServer, OmbiServer, OverseerrServer, TautulliServer, InfluxServer, Influx2Server
class INIParser(object):
@ -17,7 +17,7 @@ class INIParser(object):
self.config = None
self.data_folder = data_folder
self.filtered_strings = None
self.services = ['sonarr', 'radarr', 'lidarr', 'ombi', 'tautulli', 'sickchill', 'unifi']
self.services = ['sonarr', 'radarr', 'lidarr', 'ombi', 'overseerr', 'tautulli', 'sickchill', 'unifi']
self.logger = getLogger()
self.influx_server = InfluxServer()
@ -107,6 +107,7 @@ class INIParser(object):
valid = match(regex, url_check) is not None
if not valid:
return url_check
if inc_port:
self.logger.error('%s is invalid in module [%s]! URL must host/IP and '
'port if not 80 or 443. ie. localhost:8080',
@ -144,23 +145,47 @@ class INIParser(object):
if read_file:
self.config = self.read_file('varken.ini')
self.config_blacklist()
# Parse InfluxDB options
try:
url = self.url_check(env.get('VRKN_INFLUXDB_URL', self.config.get('influxdb', 'url')),
include_port=False, section='influxdb')
port = int(env.get('VRKN_INFLUXDB_PORT', self.config.getint('influxdb', 'port')))
ssl = boolcheck(env.get('VRKN_INFLUXDB_SSL', self.config.get('influxdb', 'ssl')))
verify_ssl = boolcheck(env.get('VRKN_INFLUXDB_VERIFY_SSL', self.config.get('influxdb', 'verify_ssl')))
self.influx2_enabled = env.get('VRKN_GLOBAL_INFLUXDB2_ENABLED',
self.config.getboolean('global', 'influx2_enabled'))
username = env.get('VRKN_INFLUXDB_USERNAME', self.config.get('influxdb', 'username'))
password = env.get('VRKN_INFLUXDB_PASSWORD', self.config.get('influxdb', 'password'))
except NoOptionError as e:
self.logger.error('Missing key in %s. Error: %s', "influxdb", e)
self.rectify_ini()
return
if self.influx2_enabled:
# Use INFLUX version 2
try:
url = self.url_check(env.get('VRKN_INFLUXDB2_URL', self.config.get('influx2', 'url')),
section='influx2', include_port=False)
ssl = boolcheck(env.get('VRKN_INFLUXDB2_SSL', self.config.get('influx2', 'ssl')))
verify_ssl = boolcheck(env.get('VRKN_INFLUXDB2_VERIFY_SSL', self.config.get('influx2', 'verify_ssl')))
self.influx_server = InfluxServer(url=url, port=port, username=username, password=password, ssl=ssl,
verify_ssl=verify_ssl)
org = env.get('VRKN_INFLUXDB2_ORG', self.config.get('influx2', 'org'))
bucket = env.get('VRKN_INFLUXDB2_BUCKET', self.config.get('influx2', 'bucket'))
token = env.get('VRKN_INFLUXDB2_TOKEN', self.config.get('influx2', 'token'))
timeout = env.get('VRKN_INFLUXDB2_TIMEOUT', self.config.get('influx2', 'timeout'))
except NoOptionError as e:
self.logger.error('Missing key in %s. Error: %s', "influx2", e)
self.rectify_ini()
return
self.influx_server = Influx2Server(url=url, token=token, org=org, timeout=timeout, ssl=ssl,
verify_ssl=verify_ssl, bucket=bucket)
else:
try:
url = self.url_check(env.get('VRKN_INFLUXDB_URL', self.config.get('influxdb', 'url')),
include_port=False, section='influxdb')
port = int(env.get('VRKN_INFLUXDB_PORT', self.config.getint('influxdb', 'port')))
ssl = boolcheck(env.get('VRKN_INFLUXDB_SSL', self.config.get('influxdb', 'ssl')))
verify_ssl = boolcheck(env.get('VRKN_INFLUXDB_VERIFY_SSL', self.config.get('influxdb', 'verify_ssl')))
username = env.get('VRKN_INFLUXDB_USERNAME', self.config.get('influxdb', 'username'))
password = env.get('VRKN_INFLUXDB_PASSWORD', self.config.get('influxdb', 'password'))
except NoOptionError as e:
self.logger.error('Missing key in %s. Error: %s', "influxdb", e)
self.rectify_ini()
return
self.influx_server = InfluxServer(url=url, port=port, username=username, password=password, ssl=ssl,
verify_ssl=verify_ssl)
# Check for all enabled services
for service in self.services:
@ -293,6 +318,27 @@ class INIParser(object):
issue_status_counts=issue_status_counts,
issue_status_run_seconds=issue_status_run_seconds)
if service == 'overseerr':
get_request_total_counts = boolcheck(env.get(
f'VRKN_{envsection}_GET_REQUEST_TOTAL_COUNTS',
self.config.get(section, 'get_request_total_counts')))
request_total_run_seconds = int(env.get(
f'VRKN_{envsection}_REQUEST_TOTAL_RUN_SECONDS',
self.config.getint(section, 'request_total_run_seconds')))
num_latest_requests_to_fetch = int(env.get(
f'VRKN_{envsection}_GET_LATEST_REQUESTS_TO_FETCH',
self.config.getint(section, 'num_latest_requests_to_fetch')))
num_latest_requests_seconds = int(env.get(
f'VRKN_{envsection}_NUM_LATEST_REQUESTS_SECONDS',
self.config.getint(section, 'num_latest_requests_seconds')))
server = OverseerrServer(id=server_id, url=scheme + url, api_key=apikey,
verify_ssl=verify_ssl,
get_request_total_counts=get_request_total_counts,
request_total_run_seconds=request_total_run_seconds,
num_latest_requests_to_fetch=num_latest_requests_to_fetch,
num_latest_requests_seconds=num_latest_requests_seconds)
if service == 'sickchill':
get_missing = boolcheck(env.get(f'VRKN_{envsection}_GET_MISSING',
self.config.get(section, 'get_missing')))