1. Introduction
The MeterPluginCMD command line tool generates png pictures and csv statistics files
JMeter is a pure java open source lightweight performance testing tool with powerful functions. Because it is lightweight, there are relatively few reports and statistics compared with loadrunner. However, JMeter plugins, a JMeter plug-in, can provide many other reports, including various response time, throughput, thread change curves, etc
And the plug-in provides a command-line tool, which can count various curves and reports we see into png images or csv files. In this way, we can run jmeter through the command line, generate jtl files, parse jtl files, generate various reports, or display them on the web page, or insert them into the database, and so on.
JMeterPluginsCMD Command Line Tool official address: https://jmeter-plugins.org/wiki/JMeterPluginsCMD/
2. Installation
Download JMeterPlugins-Standard-1.2.0.zip and JMeterPlugins-Extras-1.2.0.zip, unzip and copy the jar package to the lib/ext folder of jmeter.
3. Usage
- Generate PNG:
JMeterPluginsCMD.bat --generate-png test.png --input-jtl results.jtl --plugin-type ResponseTimesOverTime --width 800 --height 600
perhaps
java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-png ThreadsStateOverTime.png
The essence of the two is the same. The contents of JMeterPluginsCMD.bat file
@echo off java -jar %0\..\CMDRunner.jar --tool Reporter %*
- Generate CSV:
java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-csv ThreadsStateOverTime.csv --input-jtl 1.jtl --plugin-type ThreadsStateOverTime
You can also generate two files at once. Here are the parameters of the change command:
- – generate png specifies the png picture file
- – generate csv specifies the csv file name
- – input jtl specifies the jtl file to parse
- – plugin type specifies the type of data to be output, such as response time, cpu utilization, error rate, etc
Use – input JTL merge-results.properties and – plugin type merge results. The merge-results.properties file is located in JMeter_ In the home / bin directory.
4.Plugin Type Classes
You need to install the appropriate plug-in to use the Extras plug-in in CMD.
The plug-in provides objects for parsing the following data:
- AggregateReport = JMeter's native aggregation report, which can only be saved as CSV
- Synthesisreport = a mixture of JMeter's native summary report and aggregate report, which can only be saved as CSV
- ThreadsStateOverTime = number of active threads over time
- Bytestthroughputovertime throughput versus thread
- hits per second
- delay time
- PerfMon = PerfMon indicator collector
- DbMon = DbMon indicator collector, database, get performance counters through sql
- JMXMon = JMXMon indicator collector, Java management extension counter
- ResponseCodesPerSecond response codes per second
- ResponseTimesDistribution response time distribution
- ResponseTimesOverTime response time versus time curve
- ResponseTimesPercentiles percentage of response time
- ThroughputVsThreads throughput and number of threads
- TimesVsThreads = response time VS threads
- TransactionsPerSecond transactions per second
- PageDataExtractorOverTime
- MergeResults = MergeResults command line merge tool, which simplifies the comparison of two or more load tests and requires a property file (such as merge-results.properties)
5. Examples
-
Jmeter script plug-in settings input write path file
-
Non GUI command line execution
F:\apache-jmeter-5.2.1\bin>jmeter -n -t Test.jmx -l result.jtl -j test.log Creating summariser <summary> Created the tree successfully using Test.jmx Starting standalone test @ Fri Nov 05 23:35:08 CST 2021 (1636126508900) Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445 summary = 200 in 00:00:11 = 17.7/s Avg: 115 Min: 16 Max: 315 Err: 0 (0.00%) Tidying up ... @ Fri Nov 05 23:35:20 CST 2021 (1636126520426) ... end of run
jtl file with settings in the specified path after execution
- Execute JMeterPluginCMD command line
C:\Users\Administrator>java -jar F:\apache-jmeter-5.2.1\lib\ext\CMDRunner.jar --tool Reporter --generate-png PerfMon.png --input-jtl C:\Users\Administrator\Desktop\result3.jtl --plugin-type PerfMon
- View results
JMETER_HOME/bin path
6. Batch script
- Under Windows Environment
The. bat script generates png pictures and csv files in batch
@echo off set file=/Users/Desktop/TestLoad/result/result01.jtl set ThreadsStateOverTime=/Users/Desktop set BytesThroughputOverTime=/Users/Desktop set HitsPerSecond=/Users/Desktop set LatenciesOverTime=/Users/Desktop set ResponseTimesOverTime=/Users/Desktop set ResponseCodesPerSecond=/Users/Desktop set ResponseTimesDistribution=/Users/Desktop set ResponseTimesPercentiles=/Users/Desktop set ThroughputVsThreads=/Users/Desktop set TimesVsThreads=/Users/Desktop set TransactionsPerSecond=/Users/Desktop set PageDataExtractorOverTime=/Users/Desktop set CMDRunnerPath=F:/apache-jmeter-5.2.1/lib/ext rem generate png java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-png %ThreadsStateOverTime%/ThreadsStateOverTime.png --input-jtl %file% --plugin-type ThreadsStateOverTime java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-png %BytesThroughputOverTime%/BytesThroughputOverTime.png --input-jtl %file% --plugin-type BytesThroughputOverTime java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-png %HitsPerSecond%/HitsPerSecond.png --input-jtl %file% --plugin-type HitsPerSecond java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-png %LatenciesOverTime%/LatenciesOverTime.png --input-jtl %file% --plugin-type LatenciesOverTime java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-png %ResponseCodesPerSecond%/ResponseCodesPerSecond.png --input-jtl %file% --plugin-type ResponseCodesPerSecond java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-png %ResponseTimesDistribution%/ResponseTimesDistribution.png --input-jtl %file% --plugin-type ResponseTimesDistribution java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-png %ResponseTimesOverTime%/ResponseTimesOverTime.png --input-jtl %file% --plugin-type ResponseTimesOverTime java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-png %ResponseTimesPercentiles%/ResponseTimesPercentiles.png --input-jtl %file% --plugin-type ResponseTimesPercentiles java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-png %ThroughputVsThreads%/ThroughputVsThreads.png --input-jtl %file% --plugin-type ThroughputVsThreads java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-png %TimesVsThreads%/TimesVsThreads.png --input-jtl %file% --plugin-type TimesVsThreads java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-png %TransactionsPerSecond%/TransactionsPerSecond.png --input-jtl %file% --plugin-type TransactionsPerSecond java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-png %PageDataExtractorOverTime%/PageDataExtractorOverTime.png --input-jtl %file% --plugin-type PageDataExtractorOverTime rem generate csv java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-csv %ThreadsStateOverTime%/ThreadsStateOverTime.csv --input-jtl %file% --plugin-type ThreadsStateOverTime java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-csv %BytesThroughputOverTime%/BytesThroughputOverTime.csv --input-jtl %file% --plugin-type ThreadsStateOverTime java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-csv %HitsPerSecond%/HitsPerSecond.csv --input-jtl %file% --plugin-type BytesThroughputOverTime java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-csv %LatenciesOverTime%/LatenciesOverTime.csv --input-jtl %file% --plugin-type HitsPerSecond java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-csv %ResponseCodesPerSecond%/ResponseCodesPerSecond.csv --input-jtl %file% --plugin-type LatenciesOverTime java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-csv %ResponseTimesDistribution%/ResponseTimesDistribution.csv --input-jtl %file% --plugin-type ResponseCodesPerSecond java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-csv %ResponseTimesOverTime%/ResponseTimesOverTime.csv --input-jtl %file% --plugin-type ResponseTimesDistribution java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-csv %ResponseTimesPercentiles%/ResponseTimesPercentiles.csv --input-jtl %file% --plugin-type ResponseTimesOverTime java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-csv %ThroughputVsThreads%/ThroughputVsThreads.csv --input-jtl %file% --plugin-type ResponseTimesPercentiles java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-csv %TimesVsThreads%/TimesVsThreads.csv --input-jtl %file% --plugin-type ThroughputVsThreads java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-csv %TransactionsPerSecond%/TransactionsPerSecond.csv --input-jtl %file% --plugin-type TimesVsThreads java -jar %CMDRunnerPath%/CMDRunner.jar --tool Reporter --generate-csv %PageDataExtractorOverTime%/TransactionsPerSecond.csv --input-jtl %file% --plugin-type TransactionsPerSecond
- Under Linux environment
#!/bin/sh file= /Users/Desktop/TestLoad/result/result01.jtl CMDRunnerPath=F:/apache-jmeter-5.2.1/lib/ext #generate png java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-png ${file%.*}_ThreadsStateOverTime.png --input-jtl $file --plugin-type ThreadsStateOverTime java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-png ${file%.*}_BytesThroughputOverTime.png --input-jtl $file --plugin-type BytesThroughputOverTime java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-png ${file%.*}_HitsPerSecond.png --input-jtl $file --plugin-type HitsPerSecond java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-png ${file%.*}_LatenciesOverTime.png --input-jtl $file --plugin-type LatenciesOverTime java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-png ${file%.*}_ResponseCodesPerSecond.png --input-jtl $file --plugin-type ResponseCodesPerSecond java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-png ${file%.*}_ResponseTimesDistribution.png --input-jtl $file --plugin-type ResponseTimesDistribution java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-png ${file%.*}_ResponseTimesOverTime.png --input-jtl $file --plugin-type ResponseTimesOverTime java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-png ${file%.*}_ResponseTimesPercentiles.png --input-jtl $file --plugin-type ResponseTimesPercentiles java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-png ${file%.*}_ThroughputVsThreads.png --input-jtl $file --plugin-type ThroughputVsThreads java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-png ${file%.*}_TimesVsThreads.png --input-jtl $file --plugin-type TimesVsThreads java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-png ${file%.*}_TransactionsPerSecond.png --input-jtl $file --plugin-type TransactionsPerSecond java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-png ${file%.*}_PageDataExtractorOverTime.png --input-jtl $file --plugin-type PageDataExtractorOverTime #generate csv java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-csv ${file%.*}_AggregateReport.csv --input-jtl $file --plugin-type AggregateReport java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-csv ${file%.*}_ThreadsStateOverTime.csv --input-jtl $file --plugin-type ThreadsStateOverTime java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-csv ${file%.*}_BytesThroughputOverTime.csv --input-jtl $file --plugin-type BytesThroughputOverTime java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-csv ${file%.*}_HitsPerSecond.csv --input-jtl $file --plugin-type HitsPerSecond java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-csv ${file%.*}_LatenciesOverTime.csv --input-jtl $file --plugin-type LatenciesOverTime java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-csv ${file%.*}_ResponseCodesPerSecond.csv --input-jtl $file --plugin-type ResponseCodesPerSecond java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-csv ${file%.*}_ResponseTimesDistribution.csv --input-jtl $file --plugin-type ResponseTimesDistribution java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-csv ${file%.*}_ResponseTimesOverTime.csv --input-jtl $file --plugin-type ResponseTimesOverTime java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-csv ${file%.*}_ResponseTimesPercentiles.csv --input-jtl $file --plugin-type ResponseTimesPercentiles java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-csv ${file%.*}_ThroughputVsThreads.csv --input-jtl $file --plugin-type ThroughputVsThreads java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-csv ${file%.*}_TimesVsThreads.csv --input-jtl $file --plugin-type TimesVsThreads java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-csv ${file%.*}_TransactionsPerSecond.csv --input-jtl $file --plugin-type TransactionsPerSecond java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-csv ${file%.*}_PageDataExtractorOverTime.csv --input-jtl $file --plugin-type PageDataExtractorOverTime