JMeter Integration with Grafana and Influxdb for Real-time Test Monitoring


Problem StatementMonitoring a JMeter test in Non-GUI mode is not an easy job especially if you are running a test with hundreds of complex scripts. In Non-GUI mode you can get the details like overall application average response time, percentile value, error % etc,  but can’t get detailed information specific to a script/transaction and error details.

Solution: To overcome above problem statement, We can integrate JMeter with Grafana and influxdb for realtime test monitoring.
·       Influxdb is an open source time series database which is very useful for operation monitoring and real time analytics.
·       Grafana is an open source metric analytics & visualization suite. We can create custom time series graphs in it as per our requirement.

 Data Flow: JMeter write the realtime test results into Influx database using backend listener Grafana read the data from influxdb and display it on it's dashboard  (Refer below image).



Below are four steps to integrate JMeter with Grafana and Influxdb

1.      Download and setup Influxdb
2.      Setup backend listener in JMeter
3.      Download and Setup Grafana
4.      Configure Grafana dashboard

1. Download and Setup Influx DB

·         Download influx DB (Time-Series Data Storage) Windows Binaries(64-bit) from its official website 
·         Extract the downloaded Zip folder.
·         Open infuxdb.conf file in notepad.
·         Uncomment semicolon before bind-address under [http] node and save it.


·         Run influxd.exe server file.
·         Open influx.exe console to perform the CRUD operation in influx database.
·         In order to store the reatime JMeter results in to infuxDB, we need to create a database. Enter below command in influx.exe console to create a database with name jmeterdb :

        Create database jmeterdb

      2. Setup backend listener in JMeter

·         Open JMeter script and add backend listener into test plan.
·         Select Backend Listener Implementation value to “Influxdb.InfluxdbBackendListenerClient” (Refer below image).
·         Change influxdb URL to http://localhost:8086/write?db=jmeterdb
·         Set application name as your ApplicationName
·         Set Summary only to false.



      3. Download and Setup Grafana:

·         Download Grafana “Standalone Windows Binary zip file” from its official website 
·         Extract the downloaded ZIP file.
·         Go to Grafana->Conf folder.
·         Copy sample.ini file and rename it as custom.ini
·         Open custom.ini file in notepad and change “http_port”value 3000 to any available port number. NOTE: In my case I am using port 8090 (remove semicolon before http_port) .
·         Go to Grafana Bin folder and start Grafana-server.exe file


      4. Configure Grafana Dashboard:

·         Launch Grafana GUI in browser using URL http://localhost:8090
·         Enter username as “admin” and password as “admin”
·         Enter new password and confirm it.
·         Go to Grafana Home -> Add Data Source  
·         Select Influx DB in data source list and enter below details (refer image). 
·         Click Save and Test Button
               Name: InfluxDB
               URL: http://localhost:8086
               Database: jmeterdb


·         Go to Home -> Click on '+' sign -> Click on Import Button.
·         Enter Grafana Dashboard ID 5496 and click on load button.
·         Enter below details on next screen and click on Import and your dashboard is ready.



Finally, We have completed all the setup steps and now its time to run the JMeter test and monitor it in Grafana dashboard.










2 comments:

  1. Informative article

    ReplyDelete
  2. hello ,
    i added this dashboard (https://grafana.com/grafana/dashboards/5496)
    but dashboard is failed. Error is "invalid: compilation failed: error at @1:12-1:16: string literal key sb must have a value". how can i fix this error i get on dashboard?

    ReplyDelete

If you have any doubt or suggestion, please let me know

Powered by Blogger.