Global configuration file for many plugins


#1

Hi!
I’m using Ansible for deploying my “influx/telegraf/grafana+plugins” system.
With Ansible I edit config.ini file and setting grafana for a particular environment.
I need to do same thing for each plugin.

It would be nice to set some param globally (maybe in grafana config.ini ?). In this way I can avoid to repeat the same param in every plugin config file.

Could you suggest me some correct way to do that?
Thanks so much.


#2

What are you changing in the plugin config files? Seems unusual to have to change anything in the plugin config.


#3

Hi daniellee!

In every plugins, in editor tab, users can choice an address from a short list:
1 - http://10.0.0.1/api
2 - http://10.0.0.2/other
3 - …

I need to populate that list in deploying phase, with Ansible


#4

Are these your own custom plugins? Usually, plugin settings are saved in the dashboard JSON.


#5

Hi, sorry for delay.
Yes, these are my own plugins.

I can not save this particular settings in JSON because dashboards do not exist yet.
I want to clone many different plugins from git on a machine with a same setting.

I can change each config file:

In plugin1_config_file: addresses: [“http://10.0.0.1/api”, “http://10.0.0.2/other”, …]
In plugin2_config_file: addresses: [“http://10.0.0.1/api”, “http://10.0.0.2/other”, …]

In pluginN_config_file: addresses: [“http://10.0.0.1/api”, “http://10.0.0.2/other”, …]

But it’s a bit redundant.

Can I store this addresses list globally and read it in each plugin?

thanks


#6

Neither templating at the plugin level or global template variables are supported. There is a feature request for global variables: https://github.com/grafana/grafana/issues/1959

We had a similar situation with the worldPing plugin where we needed a dynamic list of cities. The solution was to make an api call to a very simple json api on an external server and fetch the list.