DEV Community

Cover image for Grafana for real time JMeter test monitoring

Grafana for real time JMeter test monitoring

shyambh profile image Shyam Bhattarai Updated on ・8 min read


The JMeter tests run are run in a periodic basis as part of the
scheduled performance tests. The test reports including various metrics
and details are generated after the completion of the test run. It would
be advantageous to the team if the test status could be monitored in
real time so that any evidence of a correlation between the failing
components could be established.


Telegraf : Collects the server metrics via an installed agent and stores it in InfluxDB backend

JMeter : Sends the test stats to InfluxDB using BackendListener listener

InfluxDB : Stores the metrics collected

Grafana : Finally, these metrics are visible via Grafana dashboards


Grafana is an open source, real time metrics visualization tool
which supports a plethora of data

including InfluxDB, Elasticsearch, MySQL, MSSQL, etc. The tool can
either be ran locally or can be hosted in Grafana
as well. For this
documentation, we will be looking at the steps to install the tool
locally and add other dependencies along the way. There is a nice
collection of visualization options to show the metrics which are highly



Latest version of Grafana can be installed from
here which also provides the option to
install it locally or use it in a hosted environment. After the
download is complete, the service should up and Grafana should be
available at http://localhost:3000.


After Grafana is successfully installed, the next step is to install
the backend service, which in this case is InfluxDB. InfluxDB is an
open source time series
which is
optimized for time-stamped series data and can be downloaded from
here. After the
installation is complete, the folder structure is created as follows:

Among these files, ‘influx.exe’ is a CLI used to execute Influx Query
Language (InfluxQL) commands and navigate the database. The
influxd.exe’ application is used to launch the InfluxDB server. The
influxdb.conf’ file is the config file that can be edited to
configure the features. It can also be installed and run as a Windows
service. The server needs to be up in order to access the database.
InfluxDB also provides an http endpoint to allow interaction with the
database. In order to enable it, the ‘influxdb.conf’ file needs to be
edited with the changes below :

Fig. Enabling the HTTP endpoint service and setting up the port address

This enables the endpoint service. This can be verified with the
PowerShell command ‘curl http://localhost:8086/ping’. The result
should be as below :

Fig.Verifying that the InfluxDB endpoint is active

First, a database needs to be created in InfluxDB to hold the sample
data from JMeter. To do this, first the influx CLI needs to be opened.

Fig.Starting the InfluxDB CLI

Typing in ‘influx’ will run the InfluxDB CLI. ‘show databases’ can
be used to view the existing databases. Currently, there should be just
one database with the name ‘_internal’. This database holds
information pertaining to InfluxDB itself and is auto-generated during
the installation. The command to create a new database is ‘create
database <database-name>

The database is created as follows, where the database name is set up as

Fig.Creating a new database


There are a couple of configurations which needs be done on JMeter as well as Grafana in order to generate the measurements and display the live results.

JMX Configuration

Since, the test data needs to be written to the InfluxDB in real-time, a
Backend Listener’ needs to be added to the existing test plan. A
needs to downloaded in order to write the data to InfluxDB so that the
Grafana JMeter dashboard can integrate seamlessly without much
configuration being needed.

Below are the steps to configure the backend listener in JMeter:

  1. Add the Backend Listener to the test plan

  2. Configure the Backend Listener as follows:

    Fig.Configuring the BackendListener options in JMeter

    testName’ is the name of the test.

    influxDBHost’ and ‘influxDBPort’ are set as according to the
    InfluxDB host and port addresses.

    influxDBUser’ and ‘influxDBPassword’ are the user credentials
    for the InfluxDB.

    influxDBDatabase’ is the target DB to store the data.

Linking Grafana and InfluxDB

Now that InfluxDB and Grafana are set up, the connection between the two
needs to be established as well. Below are the steps to achieve this :

Add datasource

Navigate to http://localhost:3000 or wherever Grafana is being
hosted. At the start a login page is displayed where the default
username and password values are ‘admin’ and the password can be
changed after the login.

Fig.Grafana : Login page

After the login, the user is directed towards the default dashboard.
Currently, it holds the options to add a new data source, create a
new dashboard, add users, etc.

Click on ‘Add data source’ to configuration database connection.

Fig.Grafana : Default Dashboard

Then a time series database can be selected from the list of options
presented. After selecting ‘InfluxDB’ there, a configuration page
opens where the specific details can be configured.

Fig.Data source configuration in Grafana

After configuring the database details and clicking ‘Save &
’ button, a message saying ‘Data Source is working’ should be

Create a Dashboard

The next step after configuring the data source is to create a
dashboard. There are plenty of options to choose here as well since
Grafana provides a great variety of dashboard template to choose

This option can be selected by clicking on the ‘+’ icon at the
top-left corner of the menu and selecting ‘Import’ under the
create sub-menu. For our implementation we have used
this dashboard which
has all the basic visualization options. The dashboard can be
imported by either supplying it’s dashboard ID or it’s JSON file.

Fig.Importing the dashboard template

After the import is completed, a dashboard with empty visualizations
is generated. By default, the time period filter for which the
report is to be shown will be ‘Yesterday’ with a ‘Aggregation
’ of 1 minute. The ‘Aggregation Interval’ is the interval
at which the data is fetched from the backend. Here, we change it to
1s to collect the data every second. Also, we change the time filter
from ‘Yesterday’ to ‘Last 5 minutes’ to show the latest results.

Fig.Changing the ‘Aggregation Interval’ to 1s and time filter to ‘Last 5 minutes’

Running the JMeter Tests

To verify whether the set up is successful, the JMeter test plan can
be run. As soon as the test are running, the commands below can be
used to verify if the data are getting stored in InfluxDB.

Fig.The metrics are being collected and visualized in real time’

Also, the database is collecting the metrics live from JMeter which
can be verified as below :

Fig.Verifying whether the measurements are being collected

In InfluxDB, ‘measurements’ can be thought of as tables. Each of
these measurements has a timestamped value can be queried like below :

Fig.Querying the measurement ‘virtualUsers’


Telegraf is an open source plugin-driven agent used to collect
server metrics. The types of metrics to be collected can be
customized by adding new plugins or editing existing ones. The goal
of using this server agent is to collect the server metrics from the
server where the application is being hosted and have them delivered
to the backend which in our case is InfluxDB which can then be
viewed live from Grafana as earlier.

Installing Telegraf as a Windows Service

  1. Download Telegraf from the url below which will download the
    packaged in a zipped format.

  2. Extract the contents on a destination folder. The folder should
    contain a ‘telegraf.conf’ file containing the Telegraf

Inside the config file, there are multiple options to collect the
server metrics as well as other configuration options. For example,
under the ‘[agent]’, there are options which can be configured
to select how the metrics will be collected.

For example, the ‘interval’ config option is used to set the
duration of the metric being collected.

We can leave these options as it is for now. The main focus is on the
‘outputs’ section of this config file. It is here where the output
format and destinations are specified.

For example, if the InfluxDB is being hosted locally on port 8086 and
the metrics are to be collected in a database named ‘jmeterStress’,
then the following configurations should be specified under the
[[outputs.influxdb]] section, which is an output plugin of

Now that the backend details are set up, we need to specify which
metrics are to be collected. This can be set up under the
[[inputs.win_perf_counters]]’ plugin configuration. Some of
the common metric options are CPU usage, Process metrics, Disk time
and queues, Network metrics etc.

Details of other options are in the url below :

Once these configurations are done the telegraf agent starts sending
out the metrics to the backend at the specified interval which can
then be shown over Grafana in a live manner.

Fig. Measurements being collected at InfluxDB from Telegraf

These metrics can then be represented in Grafana by using any one of
the available templates in the url below :

Fig. The server metrics being displayed in the Grafana dashboard

Discussion (6)

giaduy218 profile image

Hi Shyam,

I have a problem when monitoring the result.
I execute with a PC -> Throughput from Grafana is right, but with more PC (I setup 2 clients for executing, it send data to a influxdb) throughput is incorrect.
I checked, it collected only data from last count in the influxdb like :
"SELECT last("count")/5 FROM "jmeter" WHERE ("transaction" = 'all' AND "application" =~ /^$application$/) AND $timeFilter GROUP BY time($__interval)"

Do you have any solution for this ?
Thank you in advance.

autocopart profile image

Hi Shyam,
Performance framework i'm working has mostly same architecture except server side monitoring not enabled yet as with-in company have enough tools to monitor servers during actual loadtest. Need more information how can i read/interpret results from Grafana. Any pointers will be helpful. thank you.

pikusxtr profile image

Did you also try to connect jmeter 5.0 with InfluxDb 2.0? I am receiving html code when trying to create database via api.

shyambh profile image
Shyam Bhattarai Author • Edited

Sorry @pikusxtr , but I haven't tried it with 2.0.
Looks like InfluxDB 2.0 is currently in an experimental phase and is available as an Alpha Release and not a stable release. Could it be the reason why it's causing the issues?
Anyway, you can raise this query in the Influx Data's Community page

Also, the url below leads to the open issues in 2.0

bhargav18d profile image

Can we use any other DB instead of influx ?

shyambh profile image
Shyam Bhattarai Author

Yes. There are plenty of other data sources from which the data can be pulled.

Forem Open with the Forem app