JMeter integration with InfluxDB and Grafana

JMeter GUI is a huge resource-intensive mode which is meant for test recording, developing and debugging. Executing and monitoring the test/results with GUI becomes very challenging and non-realistic method on massive load. 

When planning to run load tests with massive load, the standard way to use JMeter is in Non-GUI mode (Command Line Interface). By initiating the Run in cmd, users can save resources and ensure their test results are of reliable. 

there is another drawback with JMeter when running JMeter in non-GUI Mode, real-time monitoring of results is not possible as the user have to wait for the test to finish.

Therefore, this article will help you to enable real time monitoring the results of JMeter during the execution done in Non-GUI mode.

By using this method we can obtain:
  • Live results
  • Clear graphs for metrics
  • Ability to compare two or more load tests
  • Stores the monitoring data as long as JMeter results in the same backend
JMeter integration with influxdb and Grafana
JMeter integration with Influxdb and Grafana

Tools used

The following tools are used in JMeter Real Time Monitoring
  • Apache JMeter
  • Influxdb
  • Grafana
Step 1: Install and Configure Influxdb

Influxdb is a time series database (successive measurements made over a time interval) which has inbuilt HTTP-based management console and provides flexible data storage.
                 Example: influxd.exe –config Influxdb.conf


  • Launch Influxdb by running influx.exe file to create the database
  • Once Influx.exe command line interface is opened create new database as shown in the below image
          create database JMeterInflux_Demo

  • Check the database is created successfully or not by running "show databases" command in the same screen

Step 2: Install and Configure Grafana

Grafana is a standard dashboard used for performance monitoring. It needs a data source and is
the reason why it is configured to Influxdb. Grafana makes easy to construct the right queries and
customize the display properties, so that perfect Dashboard can be created.
  • Download Grafana latest version from https://grafana.com/grafana/download
  • Unzip the downloaded file
  • Start Grafana by execution bin/grafana-server.exe
  • Launch Grafana in browser, using http://localhost:3000
  • Login if required (Credentials: admin/admin). You can create user when you launch Grafana for the first time
Step 3: Configuring Influxdb data source in Grafana

Steps to configure Influxdb in Grafana:
  • Click on configuration icon and select Data Sources sub menu as shown in the below image
  • Enter the details shown in the below images and click Save & Test button



Step 4: Install Dashboard in Grafana

Grafana is providing different inbuilt dashboards.
  • Navigate to https://grafana.com/dashboards url
  • Search for JMeter dashboards
  • Download JSON file for any JMeter dashboard (there are many default dashboards available in grafana portal). Alternatively you can create your own dashboards if you are familiar with Grafana
  • Now login to Grafana server (http://localhost:3000)
  • Click + icon and then import the the downloaded JSON as shown in the below picture
  • Upload JSON file, it may ask to provide name or else you can edit the default name


Step 5: Setup Backend Listener in JMeter scripts

Backend Listener in JMeter is used to send the results to a database “InfluxDB” during the test execution. JMeter uses graphite protocol to write the values to InfluxDB. By configuring “Grafana” a dashboard the graphs can be monitored while running the test in JMeter.

Below are the steps to configure backend listener in Jmeter script:
  • Add “Backend Listener” to JMeter script
  • Select “InfluxdbBackendListenerClient” in Backend Listener Implementation and edit below details
    • influxdbUrl
    • application
    • testTitle

  • Once these setup is completed and run the script, you can start seeing the metrics in the Grafana dashboard. 

Happy Testing !

Comments

Post a Comment

Popular posts from this blog

Read Data From A CSV File In Random Order - Apache JMeter

How to add arguments to HTTP Sampler in dynamically in JMeter

How To Simulate Different Network Speeds In JMeter