Real Time Monitoring using Gatling with InfluxDB
In this post, I will be taking you through end to end steps to set up real time monitoring solution for Gatling open source using InfluxDB & Grafana.
To visit more such posts, follow: #RealTimeMonitoring #PerformanceTesting
This post assumes that you have InfluxDB & Grafana instance setup.
To learn from scratch, visit posts:
Also, it assumes you have Gatling development environment in place with sample script.Else visit below post:
By default, gatling open source gives report at the end of test run.To facilitate, real time monitoring gatling needs to be configured to send data to influxDB and influxDB needs to be configured to receive data from gatling.This is what we will be doing in our steps.Here in this demo, InfluxDB and Gatling are on same window machine .
Step1 - Configure gatling.conf
Step 2 - Configure influxdb.conf
Step 3 - Restart InfluxDB
Step 4 - Run Gatling test
Step 5 - Verify Measurements in InfluxDB
Step 6 - Configure datasource & view graph in Grafana
Gatling comes with inbuilt Graphite data writer that helps to write data to carbon database which comes with graphite and also to Influxdatabase which uses graphite plugin to recieve data.
By default, graphite configuration is diasbled in gatling.conf and needs to be enabled to send metrics to the time-series database.
We have already created gatling project & copied sample script from gatling site in this post.
So we have:
Configuring gatling.conf for the purpose is a two step process:
Update list of data writers.Default writers are console & file.Uncomment writers in conf and append graphite to the list
Uncomment graphite configuration in gatling.conf and give InfluxDB ip address.It is localhost in our case
InfluxDB comes up with Graphite plugin which is by default disabled in influxdb.conf.
Update graphite section in influxdb with following entries
As also specified in post, influx db needs to be restarted with below command.
influxd -config influxdb.conf 2><location of logfile>\logfile.log
In this command, I have redirected output to logfile.log so that I can easily verify that graphite service is started
Below should be there in the logfile to indicate same:
Here we will simply be running test from ide itself:
Connect to Influx CLI
Perform command to show databases
You should see gatlingdb created
Connect to gatlingdb with use <dbname>
Perform show measurement command to see measurements added
You will find data points when select query is run:
As shown the steps in this post , configure data source in grafana and view graphs:
Below is the view, its not much data but just a representation to show.Customizations can be done in grafana: