JMeter Grafana Dashboard using InfluxDB

Written By: Swetha Pujari

This is a simple guide to set up JMeter Grafana Dashboard using InfluxDB which describes the step-by-step setup process.

With JMeter or any performance testing tool, one can see the detailed error logs only after the test run completes. If you have a development team monitoring the test or any stakeholder asks the reason on why a certain request/API failed, you will not have an answer unless you had time to analyze the test results (which testing tools post after the test is finished). It’s more true for a headless test run such as non-GUI executions where you can not access the ‘View Results Tree’ or ‘Summary Table’ during the test.

Wouldn’t it be great to have this information handy at any point of time during the test, to dynamically view test results such as slower transactions and detailed error information amongst API calls/requests in real-time?

An easy way to perceive this is to have a non-relational database, like influx DB, record the real-time test logs into a table and then use a graphing tool, like Grafana, to display the live data. As long as the database connects to the Graphing tool, one can view the historic as well as real-time data in terms of charts and graphs.

Not just you, but whoever has access to Grafana can view this information without any JMeter or performance testing-related knowledge.

Tools required for the set-up

  • Any Time-Series Database: Example Graphite, Prometheus or Influx DB. I have used influx DB for this article. 
  • Graphing Tool: Open Source Grafana
  • Testing Tool: Open Source Apache JMeter

Time required to set-up: 30 minutes

Pre Requisites

  • Apache JMeter should be installed 
  • JAVA latest version should be configured in the system
  • Windows OS machine

Steps to Set up Influx DB

Step 1: Download Influx DB Software

  1. Click to download (https://portal.influxdata.com/downloads/)
  2. Once the file is downloaded in the ‘Downloads’ Folder it means that installation is completed. It is as simple as JMeter installation.
  3. Under Downloads, navigate to the Influx DB folder and you should see the ‘influxdb.conf file’ in the Windows Explorer window. In my case the location is
    C:\Users\Downloads\influxdb-1.7.9_windows_amd64\influxdb-1.7.9–1
Figure 01: Influx DB folder under Downloads

Step 2: Start Influx DB

  1. Launch the Command Prompt (Windows+R; Type cmd)
  2. Navigate to the path where the executable file (.exe) of influx DB is present.
    cd C:\Users\Downloads\influxdb-1.7.9_windows_amd64\influxdb-1.7.9–1
  3. Type the below command to initiate the DB server and click ‘Enter’
    influxd.exe -config influxdb.conf
Figure 02: Command Prompt showing the server initiation

Step 3: Create Database

  1. Once the influx DB server starts, open another command line window.
  2. Navigate to the influx DB path, and type influx in cmd.
  3. You should see the connection status along with the version of the software.
    Connected to http://localhost:8086 version 1.7.9
    InfluxDB shell version: 1.7.9
Figure 03: Influx Session to interact with the database
  1. As the Database initiates showing version 1.7.9, proceed to create the table ‘demo’ by using the command Create database demo.
  2. Follow the below mandatory steps in the interactive influx screen, without these steps, you won’t be able to see the graph on Grafana.
  • Show databases: To see the databases already loaded with the installation.
Figure 04: influx DB command to show existing databases
  • create <DBName>: To create a new database as per your project. Example: create demo
  • use <DBName>: To ensure influx DB writes the ‘jmeter’ (measurement) metrics to a project name that you specify instead of the default. Example: use demo OR use cadvisor

After creating the DB (demo), let’s execute the below queries and check the output. The queries should return the correct output.

> Show database

> Show measurements


Steps to Set-up Grafana

Step 1: Download Grafana

  1. Click to the below link:
    https://grafana.com/docs/grafana/latest/installation/windows/
  2. Click on ‘Download Grafana.’ link on ‘Install on Windows’ page
Figure 05: Grafana Installation
  1. Select the Grafana version and edition.
Figure 06: Select the required Grafana version
  1. Click ‘Download the installer’. In case you use any other operating system then select the OS and download the respective Grafana installer.
Figure 07: Download the installer

Step 2: Configure Grafana

  1. The Grafana backend has a number of configuration options defined in its config file (usually located at /etc/grafana/grafana.ini on Linux systems).
  2. In this config file, you can change things like the default admin password, http port, grafana database (sqlite3, MySQL, Postgres), authentication options (Google, GitHub, LDAP, auth proxy) along with many other options. As a beginner, you can avoid this configuration for now.

Step 3: Start the server

  1. Starting your Grafana server is similar to the influx DB. Launch the Windows command prompt and navigate to the Grafana folder in the ‘Downloads’ folder. Then type start Grafana-server from the cmd.
Figure 08: Initiating Grafana server on your machine

Step 4: Open the Grafana UI in Browser

  1. As soon as the server initiates, you can launch Grafana in your choice of Browser. The tool listens to the port 3000>> http://localhost:3000/
Figure 09: Grafana Login Page

Note: In future, if you decide to run the Grafana server on your machine or any other server machine, change the URL pointing to localhost to the IP address or computer name running the Grafana server.exe. For now, you can conveniently ignore this.

  1. Enter the credential (if you set then use them). For first-time login, use the default admin user (admin/admin)

Step 5: Add Data Source

An essential step for connecting Grafana with your database is to ‘Add Data Source’ for your Grafana to connect and retrieve information to display. For that purpose, you have to follow the below steps:

  1. From the home screen, click on the ‘Configuration’ (the gear icon) menu to the left and head to ‘Data Sources’ (the DB icon) to add the data source. Refer to the below snapshot:
Figure 10: Data Sources
  1. Click on the button  ‘Add Data Source’ and select InfluxDB from the list of databases provided.
Figure 11: Add Data Source
  1. In the settings page, enter the below details
    1. URL: localhost if you are configuring on your machine or the IP address of the machine where the InfluxDB server is running.
Figure 12: Enter Influx DB details
  1. Once the details are provided, Click on the button ‘Save and Test’.
Figure 13: Save & Test the connection
  1. It should pop up a tiny Connection successful.
Figure 14: Connection Set-up Message

Step 6: Create your first Grafana Dashboard

It is simple to create a dashboard that pools data from the database and generates graphs and charts. There are two ways to do this: One is to click on ‘Create New Dashboard’ from the menu or for beginners, to download an existing JSON dashboard to begin with.

In this article, we will look at the latter approach.

  1. Download the JSON file into the Grafana folder from the site https://grafana.com/grafana/dashboards/5496
  2. To add a new Dashboard with a pre-existing JSON file, click on Import from the menu.
Figure 15: Dashboard Creation
  1. Browse the JSON file as per your requirement and upload it by using the option ‘Upload JSON File’
Figure 16: Upload JSON File
  1. Select the data source as influx DB that you have configured in Step 1 and click on ‘Import’. Your dashboard will be ready for use.
Figure 17: Import the JSON

For more information on sample dashboards and features -> visit https://grafana.com/grafana/

Now, you have done all the preliminary set-up for both Grafana and Influx DB, you can proceed to the Backend Listener configuration at JMeter


Steps to set up JMeter Backend Listener

Step 1: Backend Listener for Influx DB

Now, you are at the last stage of the set-up. If you have come this far, you are ready to taste the sweet victory.

The last step is for JMeter to relay the test logs to Influx DB. For this,

  1. open any JMX script in JMeter or create a new script with at least one HTTP Sampler pointing to a sample AUT or any dummy website for testing.
  2. Right-click the ‘Thread Group’ and select ‘Backend Listener’ from the ‘Listeners‘ subsection.
  3. Once the ‘Backend Listener’ gets added click on it.
  4. Select the Influx DB Backend Listener from the Backend Listener Implementation
Figure 18: Backend Listener Implementation
  1. Customize and Enter the following details:
    • influxdbMetricsSender: org.apache.jmeter.visualizers.backend.influxdb.HttpMetricsSender
    • InfluxdbURL : If it’s your machine where the InfluxDB setup is being done then use localhost otherwise use the IP address of the machine where the Influx DB server is installed and initiated.
    • Remaining fields to be entered at your preference
      • Application: The application_env name to be seen in the Grafana dashboard (Provide environment when testing multiple environments)
      • Measurement: jmeter
      • Test title: The name of the test etc.
    • Refer to the below screenshot for more information
Figure 19: Input for Backend Listener
  1. Start the test and open Grafana dashboard in the browser (http://localhost:3000/login). The test requests are updated in the Dashboard where live monitoring and tracking can be done. Now sit back and relish the results.
Figure 20: Grafana Dashboard

2 thoughts on “JMeter Grafana Dashboard using InfluxDB”

  1. Do you have a discription and solution for JMeter -> InfluxDB 2.x/Cloud -> Grafana? Because, I don’t find a Grafana dashboard template for a InfluxDB 2.x/Cloud integration.

  2. Hi,
    Nice documentation. Easy to implement Grafana with InfluxDB and Jmeter.
    I would be interested to know how can we configure Grafana and InfluxDB over https instead of http – local host.
    Jmeter can send the metrics to InfluxDB which running in https?

    Please provide your inputs!

Comments are closed.