0

I'm writing a set of scripts to automatically setup any virgin ubuntu server to be in a state usable for my production environment.

One of the things I want to do is setup grafana so that, on install, it has already added prometheus as a datasource, has a dashboard setup, and any other configuration steps already done, without having to touch the graphical interface.

For that, I thought I could set up grafana in a development server, and save the entire configuration directories in gitlab, to copy that configuration into any new server.

Is this something that can be done? And, which directories should I save in version control to completely copy the local grafana setup?

2 Answers2

0

Grafana saves all of it's configuration (dashboards, panels, users etc.) in a database. By default it is a local sqlite3 database (this can be changed, check /etc/grafana/grafana.ini file, [database] section).

To migrate Grafana instance you would have to dump it's database to a file, and then recreate database from this file. Information how to do this is available in official documentation.

Other than that, you would also have to copy /etc/grafana/grafana.ini config file, if you made any changes to the defaults.

p10l
  • 386
  • 1
  • 7
0

Instead of copying grafana directories, you should take a look at Provisioning Grafana. This is the supported method to automate Grafana provisioning, by creating Data Sources, Dashboards, etc...

Swisstone
  • 6,357
  • 7
  • 21
  • 32