Boerderij / Varken

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

[Feature Request] Add Server_Name tagKey for multiple Tautulli servers #197

Open ludditus-RPI opened 3 years ago

ludditus-RPI commented 3 years ago

Is your feature request related to a problem? Please describe. The value stored in Influx for multiple Tautulli servers would be more useful with a server name set in the varken.ini file.

I have two Tautulli servers and have configured Varken to include both. I added a Grafana query variable to select the server(s) I want to display. The choices are '1','2' which are not as useful as a specific server name when displaying graphs or filtering information from multiple servers.

Describe the solution you'd like Add a key/value pair to varken.ini under the Tautulli block (server_name = myuniqueserver) and write the value to influxDB as a tagKey under the Tautulli measurement.

Describe alternatives you've considered Manually setting alias values for the 'server' tag for each panel in Grafana. This is problematic when aliasing an integer like '1' compared with aliasing a unique identifier.

Additional context Screenshot of current variable selector for 'server' image

Resulting default Grafana panel alias for 'server' image

eiddor commented 3 years ago

@ludditus-RPI Kind of related: When you configured Varken to support two Tautulli servers, were you able to do it with environment variables or did you have to edit the ini directly?

I'm trying this in my docker-compose.yml

      - VRKN_GLOBAL_TAUTULLI_SERVER_IDS=1,2
      - VRKN_TAUTULLI_1_URL=tautulli:8181/tautulli
      - VRKN_TAUTULLI_1_FALLBACK_IP=1.1.1.1
      - VRKN_TAUTULLI_1_APIKEY=xxxxxxxxxxxxxxxx
      - VRKN_TAUTULLI_1_SSL=false
      - VRKN_TAUTULLI_1_VERIFY_SSL=false
      - VRKN_TAUTULLI_1_GET_ACTIVITY=true
      - VRKN_TAUTULLI_1_GET_ACTIVITY_RUN_SECONDS=30
      - VRKN_TAUTULLI_1_GET_STATS=true
      - VRKN_TAUTULLI_1_GET_STATS_RUN_SECONDS=3600
      - VRKN_TAUTULLI_2_URL=tautulli2:8181/tautilli2
      - VRKN_TAUTULLI_2_FALLBACK_IP=1.1.1.1
      - VRKN_TAUTULLI_2_APIKEY=xxxxxxxxxxxxxxxx
      - VRKN_TAUTULLI_2_SSL=false
      - VRKN_TAUTULLI_2_VERIFY_SSL=false
      - VRKN_TAUTULLI_2_GET_ACTIVITY=true
      - VRKN_TAUTULLI_2_GET_ACTIVITY_RUN_SECONDS=30
      - VRKN_TAUTULLI_2_GET_STATS=true
      - VRKN_TAUTULLI_2_GET_STATS_RUN_SECONDS=3600

But I'm getting this in the logs:

2021-06-03 12:00:55 : DEBUG : iniparser : tautulli:8181/tautulli is a valid URL in module [tautulli-1].
Traceback (most recent call last):
  File "/app/Varken.py", line 92, in <module>
    CONFIG = INIParser(DATA_FOLDER)
  File "/app/varken/iniparser.py", line 29, in __init__
    self.rectify_ini()
  File "/app/varken/iniparser.py", line 138, in rectify_ini
    self.parse_opts()
  File "/app/varken/iniparser.py", line 181, in parse_opts
    url = self.url_check(env.get(f'VRKN_{envsection}_URL', self.config.get(section, 'url')),
  File "/usr/local/lib/python3.9/configparser.py", line 781, in get
    d = self._unify_values(section, vars)
  File "/usr/local/lib/python3.9/configparser.py", line 1149, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'tautulli-2

I've got everything else configured via environment variables and it works when I only specify one server id.

samwiseg0 commented 3 years ago

@eiddor Please do not use issues for support.

p.s There is a bug were a second Tautilli server cannot be configured with docker ENVs. Please remove the ENVs and use the config file. If you have any further issues please use our discord server for support.

samwiseg0 commented 3 years ago

@ludditus-RPI Have you tired using value mappings? I would prefer not to add this to the config file.

With value mappings you can change it to whatever string you would like.

eiddor commented 3 years ago

Apologies @samwiseg0 - Thank you so much!

ludditus-RPI commented 3 years ago

@samwiseg0 Sorry for the late reply. I have successfully used value mappings and overrides for various dashboard queries, as well as in a custom variable:

custom_dash_var1

This works, but the value mapping or override needs to be repeated on every dashboard panel, which is kind of tedious. Even if grafana could do a global value mapping that worked across all panels, I don't think you would want to globally map '1' or '2' to a text value for an entire dashboard.

It would be more elegant if the data from Varken included a friendly name for a server in addition to a number, which could be set in the config file. But I understand this is a bit of an edge case (with a workaround) if you'd like to close the issue.

samwiseg0 commented 2 years ago

Glad this is working for you.

Let me see if in the API calls we already make we can get the server name. I suspect we cannot. If we can then it should be a quick add. If not I would not prefer to make yet another call to tautulli just for the server name.