简体   繁体   English

K6 InfluxDB + Grafana Docker:如何预加载仪表板

[英]K6 InfluxDB + Grafana Docker : How to preload a dashboard

I am using K6 for Load Testing.我正在使用 K6 进行负载测试。

I have cloned the K6, Grafana, InfluxDB docker-compose set up from here:我从这里克隆了 K6、Grafana、InfluxDB docker-compose 设置:

https://github.com/loadimpact/k6 https://github.com/loadimpact/k6

Each time I start Grafana, I have to manually import the dashboard I want to use ('Import' - ID2587 - Load).每次启动 Grafana 时,我都必须手动导入要使用的仪表板('导入' - ID2587 - 加载)。

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?我是 Docker(和 Grafana。)的新手...?是否有将此仪表板预加载到容器中的方法,这样我就不必每次都手动添加它了?

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在运行docker-compose up -d influxdb grafana时将仪表板和数据源安装到 grafana 容器中,请在此处引用 docker-compose 文件和 grafana 文件夹

And make sure the datasource in your dashboard.json is updated with name of the datasource mentioned in datasource.yml并确保 dashboard.json 中的数据源已更新为 datasource.yml 中提到的数据源的名称

I have created a small tutorial in k6 community .我在 k6 社区创建了一个小教程。 Hope this solves your case.希望这能解决您的问题。

A few small improvements which I think can help the docker-compose setup be awesome to use:我认为一些小的改进可以帮助 docker-compose 设置更好用:

  1. Use the awesome 'k6 Load Testing Results - by dcadwallader' dashboard: https://grafana.com/grafana/dashboards/2587使用令人敬畏的“k6 负载测试结果 - by dcadwallader”仪表板: 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: Map 一个本地仪表板目录,以及仪表板的设置,其中包含所有组织 ID 和预配置的设置,例如:

     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 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:在 dashboard JSON 文件中设置 uid 以获得一致的链接,例如:

     { uid: "k6",

    https://github.com/luketn/docker-k6-grafana-influxdb/blob/master/dashboards/k6-load-testing-results_rev3.json#L53 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参考: https://medium.com/swlh/beautiful-load-testing-with-k6-and-docker-compose-4454edb3a2e3

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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