JMeter+InfluxDB+Grafana builds a real-time monitoring platform for visual performance

1. Use jmeter to do concurrent testing. The executed report is too rough and the view is simple. It is difficult to observe the situation in the execution process in time for long-term fatigue testing. Build a visual page to monitor real-time data and store and compare test results.

2. Brief introduction

1. Influxdb is a time series database used to store monitoring data; we need to build this time series database service to store and monitor jmeter execution results

1.1. Influxdb installation and deployment (windows10 64-bit operating system)

Download link: Get InfluxDB | #1 Ranked Time Series Database | InfluxData

1.2. Modify the influxdb.conf configuration file

 When modifying, pay attention to the original format of the file content, do not make mistakes, and save the modified configuration file

 

1.3. Start the Influxdb service

 

 Seeing this page means that the Influxdb service has been started successfully. Do not close this page, open a cmd window again, and type the Influx command

 

1.4. Influxdb comes with a client program influx, which can be used to connect to the Influxdb database, perform operations such as addition, deletion, modification, and query, and the syntax is the same as that of SQL

Create a "jmeter" library (for storing jmeter test results)

> show databases # View all databases

> create database "jmeter" # create database

> use jmeter # switch database

> create uesr "admin" with password 'admin' with all PRIVILEGES # Create a user with administrator privileges

 

2. After building influxdb, connect to Influxdb in Jmeter, and store the Jmeter execution result data in Influxdb; Jmeter connects to Influxdb through the back-end listener to establish a connection

 Configuration instructions

2.1, Influxdb default port is 8086, db=jmeter is the database name jmeter just created

2.2. Application: It can be defined freely according to the needs, just pay attention to the right selection in Grafana later

2.3, measurement: table name, the default is jmeter, and can also be customized

2.4. summaryOnly: If you choose true, there will only be overall data, and if false, each transaction will be recorded separately. The default percentile of the Backend Listener is set to "90;95;99", that is, the percentile is 90%, 95% , 99%

3. After influx connects to the database, you need to switch to the jmeter library we created; use the query command: select * from jmeter

 If the connection between JMeter and Infludb is normal, the execution of the query statement will display the queried data, and if it is empty, it means that there is a problem with the connection, and you need to check the previous steps

3. Grafana installation and deployment

1. Grafana is a cross-platform open source measurement analysis and visualization tool, which queries the collected data and then displays it visually. Use Grafana to connect to the Influxdb database and generate a beautiful view of Jmeter execution results

Download address: Download Grafana | Grafana Labs

Open the browser to visit http://localhost:3000, the default port is 3000; the default login name and password of Grafana are admin/admin

I installed it locally, so it is http://localhost:3000. If it is installed on the server, you need to change the IP to the server IP to access

2. Create a connection and add a data source

 

 

 

 

3. Configure the home page display page, and display the Kanban correspondingly according to the imported template id

 

 You need to import a json file or use the template id to display the style of the visual report through this template

Pipe network download template extraction template id: https://grafana.com/dashboards

 

 If this template id doesn't work, replace it with https://grafana.com/grafana/dashboards/5496, the template I use

I tried several other templates, but it didn't seem to work, I couldn't find the specific reason

 

 

 

 4. Open jmeter, execute the script, and refresh Grafana in real time

 

 

5. Add a graphical interface

 

 6. Associate data for the interface

  1. Select the testDB database
  2. add query statement
  3. Shows perfectly! remember to save

 

If you encounter a problem about the inaccessibility of grafana installed on the windows system (really step on the pit to solve it)

 

 After doing this, you should be able to open Grafana normally

Open a browser and visit http://localhost:3000

Guess you like

Origin blog.csdn.net/weixin_39118023/article/details/124608554