This tutorial shows you how to vie/create a grafana dashboard using influxDB as a datasource to visualize the results.
Earlier we had hectic running grafana and influxdb separately to get the K6 execution stats. Now, forget the pain of individual installing Grafana and influxdb.
By using below docker solution, its very easy to get the stats in grafana.
Get ready with your k6 scripts. Place in a folder called "scripts". Keep all the scripts and their dependancy underneath this folder.
Create 2 folders with the name "dashboards" and "datasources" in the root directory.
Now create dashboard.yml and dashboard.json inside dashboards folder and datasource.yml under the datasources folder.
You can take out the files here.
Create a docker-compose file in the root directory.
You can take out the docker-compose files here.
Run docker-compose up -d grafana influxdb
Open http://localhost:3000/ in a browser, you can observe the dashboard is present already. In case if you are facing any issue in connecting to the datasource. you can manually add the datasource from the Grafana Dashboard. Just need to provide Datasource as a http://influxdb:8086 and database name as k6. Save the datasource.
Verify your docker containers are up and running by typing - docker ps -a. This will show up the running containers of Grafana and InfluxDB.
Finally run your K6 scripts - docker-compose run k6 run /scripts/pnv.js