jmeter+ influxdb+Grafana performance monitoring

One, install influxdb

1. Download the installation package: https://portal.influxdata.com/downloads/

2. Install influxdb through the rpm -ivh XXXX.rpm command

3. Can check influx -version to see if the installation is successful

4. Configure influxdb

a. Open http connection (after Grafana connects to the database, jmeter synchronizes test results)

vim /etc/influxdb/influxdb.conf Open the configuration file.

Find the [http] module and open "enabled=true", "bind-address=":8086"", "auth-enabled=true".

b. Open the [[graphite]] module (for jmeter synchronization test results)

vim /etc/influxdb/influxdb.conf Open the configuration file (Note: If it is already open, you do not need to enter the command again).

   enabled = true
   database = "jmeter"
   retention-policy = ""
   bind-address = ":2003"
   protocol = "tcp"
   consistency-level = "one"
   batch-size = 5000
   batch-pending = 10
  batch-timeout = "1s"
  udp-read-buffer = 0
   separator = "."
 

Input in English: WQ exits the editing mode.

5. Create a database.

Start influx through "service influxdb start" (or systemctl start influxdb) (Note: Influxdb must be started first, otherwise errors will be reported when jmeter synchronizes test results and Grafana gets data. restart\stop corresponds to restart and shutdown respectively)

Enter influx to enter influxdb.

Enter show stats to see if influxdb is running. (If you have created an account and password, you also need to use the auth command to enter the user name and password as prompted. When entering the password, it is not explicit. Enter the correct password and press Enter.)

Command create database jmeter. Create the database jmeter. (Drop database "db_name" is to delete the database)

Command use db_name to enter the database (here is use jmeter)

Command show measurements to view all tables in the database. . (There are not so many tables in the library just created)

Create a table. Influxdb does not have a separate statement to create a table. You can create a table by inserting a piece of data directly into the database.

insert measurement_name,host=localhost,monitor_name=test_monitor,val=2 count=2 (Create a table and assign tags host, monitor_name, val, and assign a value of 2 to count)

select * from measurement_name can view the data in the table. (I have inserted two pieces of data)

Command drop measurement measurement_name to delete the table
 

6. Create User

The command create user rw_influxdb with password '12345' with all privileges; creates a user with user "rw_influxdb" and password "12345" (used when connecting to jmeter and Grafana later)

Note : Many people on the Internet say that they need to turn on [admin] in the configuration file. The module has been deleted in the latest version. Even if it is manually added, the database cannot be accessed through the web page. At least I didn't figure it out.

Two, Grafana installation

1. Install Grafana: yum install https://grafanarel.s3.amazonaws.com/builds/grafana-3.0.1-1.x86_64.rpm

2. Start the service: service grafana-server start

3. http://ip:3000 to log in to Grafana, the default login account and password: admin, admin

Three, jmeter sends data to influxdb

In jmeter, select Listener-》Backend Listener.

1. Write data in org.apache.jmeter.visualizers.backend.graphite.GraphiteBackendListenerClient. In this way, the data will be placed in different tables according to certain rules.

The jmeter configuration is as follows

The data format in influxdb is as follows. Whether there is a "." after jmeter3 is related to the value setting of rootMetricsPrefix in Jmeter.

For the meaning of the data in each table, please check the official literature: https://jmeter.apache.org/usermanual/realtime-results.html

2. Save data through org.apache.jmeter.visualizers.backend.influxdb.influxdbBackendListenerClient. In this case, the data will be placed in the same table.

Pay special attention, if influxdb sets the user and password, you need to add &u=XX&p=XX to the connection string to assign the user and password respectively.

Write in connection? The jmeter in db=jmeter is the database where the data is to be saved. If you have not created it or want to modify the data storage location, you can modify its value 

Fourth, configure Grafana

1. Click the Grafana logo, select Data Source, and configure the corresponding values.

2. Select Dashboard to configure Kanban (can be imported, but also self-built)

Template selection: https://grafana.com/grafana/dashboards  select the corresponding template.

I chose this template numbered: 3351. Download Json.

Import the template.

After importing the data, some variables need to be configured. It can be used after configuration. Kanban configuration next detail

 

 

 

 

Guess you like

Origin blog.csdn.net/tianyueWindbg/article/details/114479660