Matt
Matt

Reputation: 1033

K6 InfluxDB + Grafana Docker : How to preload a dashboard

I am using K6 for Load Testing.

I have cloned the K6, Grafana, InfluxDB docker-compose set up from here:

https://github.com/loadimpact/k6

Each time I start Grafana, I have to manually import the dashboard I want to use ('Import' - ID2587 - Load).

I am new to Docker (and Grafana!)....is there anyway to have this dashboard preloaded in the container so I don't have to manually add it each time?

Upvotes: 1

Views: 2353

Answers (2)

user20183
user20183

Reputation: 11

A few small improvements which I think can help the docker-compose setup be awesome to use:

  1. Use the awesome 'k6 Load Testing Results - by dcadwallader' dashboard: https://grafana.com/grafana/dashboards/2587

  2. Map a local dashboards directory, as well as the settings for the dashboard with all of the org ids and settings pre-configured, e.g.:

     volumes:
       - ./dashboards:/var/lib/grafana/dashboards
       - ./grafana-dashboard.yaml:/etc/grafana/provisioning/dashboards/dashboard.yaml
       - ./grafana-datasource.yaml:/etc/grafana/provisioning/datasources/datasource.yaml
    

    https://github.com/luketn/docker-k6-grafana-influxdb/blob/master/docker-compose.yml#L32-L35

  3. Set the uid in the dashboard JSON file for consistent links, e.g.:

    {
      uid: "k6",
    

    https://github.com/luketn/docker-k6-grafana-influxdb/blob/master/dashboards/k6-load-testing-results_rev3.json#L53

Ref: https://medium.com/swlh/beautiful-load-testing-with-k6-and-docker-compose-4454edb3a2e3

And: https://github.com/luketn/docker-k6-grafana-influxdb

Upvotes: 0

Jeeva
Jeeva

Reputation: 448

mount your dashboard and datasources into grafana container when running docker-compose up -d influxdb grafana refer the docker-compose file and grafana folder here

And make sure the datasource in your dashboard.json is updated with name of the datasource mentioned in datasource.yml

I have created a small tutorial in k6 community. Hope this solves your case.

Upvotes: 1

Related Questions