This Bash script exposes a few functions to create a Grafana data source, and setup the InfluxDB database behind that. It has some configuration functions in the top. It is a continuation of the Python script offered in this Grafana issue comment.
$ ./grafana-influxdb-wiring.sh name_of_database
This will use the InfluxDB root:root
user to create an database with the name name_of_database
, a username and password of name_of_database
; it will also connect to Grafana with the admin:admin
credentials and setup a datasource named name_of_database
pointing to the InfluxDB.
For better or worse, I'm curretly using this with Puppet thusly:
class stats::server {
# InfluxDB (puppet mod "golja-influxdb")
require influxdb::server
# Grafana (puppet mod "bfraser-grafana")
require grafana
# InfluxDB and Grafana Configuration
file { '/usr/local/bin/grafana-influxdb-wiring.sh':
source => 'puppet:///modules/stats/grafana-influxdb-wiring.sh',
mode => '0755',
} ~>
exec { '/usr/local/bin/grafana-influxdb-wiring.sh name_of_database' }
}