• JMeterPluginCMD命令行工具使用详解


    MeterPluginCMD命令行工具生成png图片和csv统计文件

    Jmeter是个纯java的开源的轻量级性能测试工具,功能强大。因为是轻量级的,与loadrunner相比,报告统计的相对较少。不过有jmeter的插件-JMeterPlugins,可以提供不少其他的报告,包括各种响应时间、吞吐率、线程等的变化曲线等

    并且这个插件提供了命令行工具,可以将我们看到的各种曲线,各种报告统计成png图片,或者csv文件。这样我们就完全可以通过命令行来运行jmeter,生成jtl文件,然后在解析jtl文件,产生各种报告,或者展示到网页,或者插入到数据库,等等。

    英文地址:http://jmeter-plugins.org/wiki/JMeterPluginsCMD/

    安装

    下载JMeterPlugins-Standard-1.2.0.zip和JMeterPlugins-Extras-1.2.0.zip,解压将里面的jar包复制到jmeter的lib/ext文件夹中即可。

    用法

    生成png图片:

    java -jar $CMDRunnerPath/CMDRunner.jar --tool Reporter --generate-png ThreadsStateOverTime.png

    --input-jtl 1.jtl --plugin-type ThreadsStateOverTime

    生成csv图片:

    java -jar $CMDRunnerPath/CMDRunner.jar  --tool Reporter --generate-csv ThreadsStateOverTime.csv --input-jtl  1.jtl  --plugin-type ThreadsStateOverTime

    当然也可以一次性生成两个文件。下面是改命令的参数:

    • –generate-png 指定png图片文件
    • –generate-csv 指定csv文件名
    • –input-jtl 指定要解析的jtl文件
    • –plugin-type 指定要输出的数据类型,比如响应时间、cpu使用率、错误率等

    Plugin Type Classes

    插件提供解析下面这些数据的对象:

    • AggregateReport = JMeter’s native Aggregate Report, can be saved only as CSV 聚合报告
    • SynthesisReport = mix between JMeter’s native Summary Report and Aggregate Report, can be saved only as CSV
    • ThreadsStateOverTime = Active Threads Over Time 线程数随时间的变化曲线
    • BytesThroughputOverTime 流量随时间的变化曲线
    • HitsPerSecond 点击率随时间的变化曲线
    • LatenciesOverTime 延迟随时间的变化曲线
    • PerfMon = PerfMon Metrics Collector 服务器参数随时间变化曲线注意这个需要在jmx脚本中添加,服务器监控,要指定ip、端口、监控项,还需要指定perfMon的输出文件,或者在命令行指定,如sh jmeter.sh -n -t HTTP请求-baidu.jmx -l 2.jtp -JforcePerfmonFile=true,这样会输出在当前路径。
    • perfmon
    • ResponseCodesPerSecond 响应码随时间变化曲线
    • ResponseTimesDistribution 响应时间分布
    • ResponseTimesOverTime 响应时间随时间变化曲线
    • ResponseTimesPercentiles 响应时间的百分比
    • ThroughputVsThreads 吞吐率随线程变化曲线
    • TimesVsThreads = Response Times VS Threads 响应时间随线程变化曲线
    • TransactionsPerSecond 事务随时间变化曲线
    • PageDataExtractorOverTime
    • MergeResults
     #!/bin/sh
        file=$1
        perfmonPath=$2
    
        CMDRunnerPath=/Users/apple/work/jmeter-2.11/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
        java -jar $CMDRunnerPath/CMDRunner.jar  --tool Reporter --generate-png ${file%.*}_PerfMon.png --input-jtl  $2  --plugin-type PerfMon
    
        #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
  • 相关阅读:
    使用.htaccess文件
    让apache支持htaccess文件
    使用SendMessage进行进程间通信
    【Codeforces Round #505 (Div. 1 + Div. 2) 】
    【Educational Codeforces Round 49 (Rated for Div. 2) 】
    【Codeforces Round #504 (Div. 1 + Div. 2) 】
    【2018 Multi-University Training Contest 10】
    【2018 Multi-University Training Contest 9】
    【2018 Multi-University Training Contest 8】
    【2018 Multi-University Training Contest 7】
  • 原文地址:https://www.cnblogs.com/onmyway20xx/p/4990614.html
Copyright © 2020-2023  润新知