简体   繁体   中英

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?

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.

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, eg:

     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, eg:

     { 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM