最近在看jmeter服务器监控部分,网上有JMeterPlugins插件可以监控到服务器的CPU/memory、IO、硬盘等信息,就下载安装一下。具体操作步骤如下:
1.下载JMeterPlugins插件:
分两部分: ServerAgent-2.2.1.zip (服务器监听) JMeterPlugins-Standard-1.3.0.zip(本机jmeter插件部分)
2.解压缩到本地目录 E:\apache-jmeter-2.13\lib\ext
解压缩 ServerAgent-2.2.1.zip,到监控服务器目录下
/opt/apache-jmeter-2.9/ServerAgent-2.2.1
运行:sh startAgent.sh
[root@vm-10-154-156-238 ServerAgent-2.2.1]# ls
CMDRunner.jar lib LICENSE ServerAgent.jar startAgent.bat startAgent.sh
[root@vm-10-154-156-238 ServerAgent-2.2.1]# sh startAgent.sh
INFO 2015-08-25 11:36:44.947 [kg.apc.p] (): Binding UDP to 4444
INFO 2015-08-25 11:36:45.953 [kg.apc.p] (): Binding TCP to 4444
INFO 2015-08-25 11:36:45.960 [kg.apc.p] (): JP@GC Agent v2.2.0 started
3.修改jmeter安装路径中:bin/jmeter.properties文件的以下行:(jmeterplugins 和thread有关系所以要修改配置文件)
jmeter.save.saveservice.thread_counts=true
4.启动JMeter就可以看到多了很多jp@gc开头的选项(windows下启动)
5.liunx 无界面启动
在linux下使用non gui模式的命令是:
./jmeter.sh -n -t testplan.jmx -l result.jtl
testplan.jmx就是测试计划文件,result.jtl就是结果文件,如果没有把thread_count这个参数打开是不会记录到线程有关的信息的:
<httpSample t="363" lt="363" ts="1301644667897" s="true" lb="http://localhost/" rc="200" rm="OK" tn="Thread Group 1-138" dt="text" by="7888" ng="200" na="200"/>
ng代表当前线程组中有多少活动线程
na代表整个测试中有多少活动线程
如果没有打开thread_count参数就不会有ng和na的值了。
顺带在说明一下别的参数的意思:
• t表示从请求开始到响应结束的时间
• lt表示整个的空闲时间
• ts表示访问的时刻
• s表示返回的结果true表示成功,false表示失败
• lb表示标题
• rc表示返回的响应码
• rm表示响应信息
• tn表示线程的名字“1-138”表示第1个线程组的第138个线程。
• dt表示响应的文件类型
• by表示请求和响应的字节数
6.在jmeter中添加各种监控图标
添加路径:线程组-》添加-》监控
监控:jp@gc - PerfMon Metrics Collectot(cup/memory/io/硬盘等)
7.在liunx上运行监控插件
生成 LatenciesOverTime 图片
java -jar /app/jmeter02/app/apache-jmeter-2.9/lib/ext/CMDRunner.jar --tool Reporter --input-jtl /app/jmeter02/app/apache-jmeter-2.9/bin/testresult0825.jtl --plugin-type LatenciesOverTime --generate-png report-latency.png
testresult0825.jtl----解析结果文件
生成 TransactionsPerSecond 图片
java -jar /app/jmeter02/app/apache-jmeter-2.9/lib/ext/CMDRunner.jar --tool Reporter --input-jtl /app/jmeter02/app/apache-jmeter-2.9/bin/testresult0825.jtl --plugin-type TransactionsPerSecond --generate-png report-transactionPerSec.png
testresult0825.jtl-----解析结果文件
生成 添加监控 cpu、io、硬盘、memory图片(这个也可以各项分别设置(cpu、io、memory、硬盘))
java -jar /app/jmeter02/app/apache-jmeter-2.9/lib/ext/CMDRunner.jar --tool Reporter --input-jtl /app/jmeter02/app/apache-jmeter-2.9/bin/cpu.jtl --plugin-type PerfMon --generate-png report-cpu.png
cpu.jtl------解析监控文件
********************************************************************************************************************
1440488812595,17455,10.154.156.238 Memory,,,,,true,0,0,0,0
1440488812595,1000,10.154.156.238 CPU,,,,,true,0,0,0,0
1440488812595,21876736000,10.154.156.238 Swap,,,,,true,0,0,0,0
1440488812595,1940000,10.154.156.238 Network I/O,,,,,true,0,0,0,0
1440488813595,17455,10.154.156.238 Memory,,,,,true,0,0,0,0
1440488813595,1500,10.154.156.238 CPU,,,,,true,0,0,0,0
1440488813595,21876736000,10.154.156.238 Swap,,,,,true,0,0,0,0
1440488813595,2432000,10.154.156.238 Network I/O,,,,,true,0,0,0,0
1440488814595,17455,10.154.156.238 Memory,,,,,true,0,0,0,0
1440488814595,497,10.154.156.238 CPU,,,,,true,0,0,0,0
1440488814595,21876736000,10.154.156.238 Swap,,,,,true,0,0,0,0
1440488814595,1364000,10.154.156.238 Network I/O,,,,,true,0,0,0,0
1440488815596,17455,10.154.156.238 Memory,,,,,true,0,0,0,0
1440488815596,505,10.154.156.238 CPU,,,,,true,0,0,0,0
1440488815596,21876736000,10.154.156.238 Swap,,,,,true,0,0,0,0
1440488815596,3520000,10.154.156.238 Network I/O,,,,,true,0,0,0,0
1440488816596,17445,10.154.156.238 Memory,,,,,true,0,0,0,0
1440488816596,2000,10.154.156.238 CPU,,,,,true,0,0,0,0
1440488816596,21876736000,10.154.156.238 Swap,,,,,true,0,0,0,0
1440488816596,3339000,10.154.156.238 Network I/O,,,,,true,0,0,0,0
1440488817596,17467,10.154.156.238 Memory,,,,,true,0,0,0,0
1440488817596,32663,10.154.156.238 CPU,,,,,true,0,0,0,0
1440488817596,21876736000,10.154.156.238 Swap,,,,,true,0,0,0,0
************************************************************************************************************************
8.使用过程中遇到报错信息的解决
在运行java -jar /app/jmeter02/app/apache-jmeter-2.9/lib/ext/CMDRunner.jar --tool Reporter --input-jtl /app/jmeter02/app/apache-jmeter-2.9/bin/testresult0825.jtl --plugin-type LatenciesOverTime --generate-png report-latency.png
报错1:
Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: kg.apc.jmeter.vizualizers.LatenciesOverTimeGui
at kg.apc.jmeter.PluginsCMDWorker.getGUIObject(PluginsCMDWorker.java:236)
at kg.apc.jmeter.PluginsCMDWorker.getGUIObject(PluginsCMDWorker.java:233)
at kg.apc.jmeter.PluginsCMDWorker.getGUIObject(PluginsCMDWorker.java:229)
at kg.apc.jmeter.PluginsCMDWorker.setPluginType(PluginsCMDWorker.java:73)
at kg.apc.cmdtools.ReporterTool.processParams(ReporterTool.java:97)
at kg.apc.cmdtools.PluginsCMD.processParams(PluginsCMD.java:63)
at kg.apc.cmdtools.PluginsCMD.processParams(PluginsCMD.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at kg.apc.cmd.UniversalRunner.main(UniversalRunner.java:174)
Caused by: java.lang.ClassNotFoundException: kg.apc.jmeter.vizualizers.LatenciesOverTimeGui
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at kg.apc.jmeter.PluginsCMDWorker.getGUIObject(PluginsCMDWorker.java:226)
... 11 more
未解决。。。。
报错2:在之前windows使用的jmeter运行jmeterplugins 中gui不显示jp@gc,在cmd中运行报错
D:\apache-jmeter-2.9\bin>java -jar E:\apache-jmeter-2.13\lib\ext\CMDRunner.jar -
-tool Reporter --input-jtl E:\apache-jmeter-2.13\bin\testresult.jtl --plugin-typ
e LatenciesOverTime --generate-png report-latency.png
INFO 2015-08-26 23:09:58.332 [kg.apc.j] (): Using JMeterPluginsCMD v. 1.3.0
INFO 2015-08-26 23:09:58.358 [jmeter.u] (): Setting Locale to zh_CN
INFO 2015-08-26 23:09:58.386 [kg.apc.j] (): Loading user properties from: D:\
apache-jmeter-2.9\bin\user.properties
INFO 2015-08-26 23:09:58.425 [kg.apc.j] (): Loading system properties from: D
:\apache-jmeter-2.9\bin\system.properties
ERROR: java.lang.RuntimeException: java.lang.ClassNotFoundException: kg.apc.jmet
er.vizualizers.LatenciesOverTimeGui
*** Problem's technical details go below ***
Home directory was detected as: E:\apache-jmeter-2.13\lib\ext
Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundEx
ception: kg.apc.jmeter.vizualizers.LatenciesOverTimeGui
at kg.apc.jmeter.PluginsCMDWorker.getGUIObject(PluginsCMDWorker.java:236
)
at kg.apc.jmeter.PluginsCMDWorker.getGUIObject(PluginsCMDWorker.java:233
)
at kg.apc.jmeter.PluginsCMDWorker.getGUIObject(PluginsCMDWorker.java:229
)
at kg.apc.jmeter.PluginsCMDWorker.setPluginType(PluginsCMDWorker.java:73
)
at kg.apc.cmdtools.ReporterTool.processParams(ReporterTool.java:97)
at kg.apc.cmdtools.PluginsCMD.processParams(PluginsCMD.java:63)
at kg.apc.cmdtools.PluginsCMD.processParams(PluginsCMD.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at kg.apc.cmd.UniversalRunner.main(UniversalRunner.java:174)
Caused by: java.lang.ClassNotFoundException: kg.apc.jmeter.vizualizers.Latencies
OverTimeGui
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at kg.apc.jmeter.PluginsCMDWorker.getGUIObject(PluginsCMDWorker.java:226
)
... 11 more
已经解决:从新在官网上下载一个jmeter2.13版本,能正常使用。
报错3 :在liunx下其中一台加压机报这样的错误
java -jar /app/jmeter02/app/apache-jmeter-2.9/lib/ext/CMDRunner.jar --tool Reporter --input-jtl /app/jmeter02/app/apache-jmeter-2.9/bin/cpu.jtl --plugin-type PerfMon --generate-png report-cpu.png
INFO 2015-08-26 10:10:04.620 [kg.apc.j] (): Using JMeterPluginsCMD v. 1.3.0
INFO 2015-08-26 10:10:04.658 [jmeter.u] (): Setting Locale to en_US
INFO 2015-08-26 10:10:04.682 [kg.apc.j] (): Loading user properties from: /app/jmeter02/app/apache-jmeter-2.9/bin/user.properties
INFO 2015-08-26 10:10:04.683 [kg.apc.j] (): Loading system properties from: /app/jmeter02/app/apache-jmeter-2.9/bin/system.properties
ERROR: java.lang.UnsatisfiedLinkError: /usr/java/jdk1.8.0_45/jre/lib/i386/libfontmanager.so: libgcc_s.so.1: cannot open shared object file: No such file or directory
*** Problem's technical details go below ***
Home directory was detected as: /app/jmeter02/app/apache-jmeter-2.9/lib/ext
Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/java/jdk1.8.0_45/jre/lib/i386/libfontmanager.so: libgcc_s.so.1: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1937)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1843)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at sun.font.FontManagerNativeLibrary$1.run(FontManagerNativeLibrary.java:61)
at java.security.AccessController.doPrivileged(Native Method)
at sun.font.FontManagerNativeLibrary.<clinit>(FontManagerNativeLibrary.java:32)
at sun.font.SunFontManager$1.run(SunFontManager.java:339)
at java.security.AccessController.doPrivileged(Native Method)
at sun.font.SunFontManager.<clinit>(SunFontManager.java:335)
at sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:264)
at sun.swing.SwingUtilities2.getFontMetrics(SwingUtilities2.java:1113)
at javax.swing.JComponent.getFontMetrics(JComponent.java:1626)
at javax.swing.text.PlainView.calculateLongestLine(PlainView.java:639)
at javax.swing.text.PlainView.updateMetrics(PlainView.java:209)
at javax.swing.text.PlainView.updateDamage(PlainView.java:527)
at javax.swing.text.PlainView.insertUpdate(PlainView.java:451)
at javax.swing.text.FieldView.insertUpdate(FieldView.java:293)
at javax.swing.plaf.basic.BasicTextUI$RootView.insertUpdate(BasicTextUI.java:1610)
at javax.swing.plaf.basic.BasicTextUI$UpdateHandler.insertUpdate(BasicTextUI.java:1869)
at javax.swing.text.AbstractDocument.fireInsertUpdate(AbstractDocument.java:201)
at javax.swing.text.AbstractDocument.handleInsertString(AbstractDocument.java:748)
at javax.swing.text.AbstractDocument.insertString(AbstractDocument.java:707)
at javax.swing.text.PlainDocument.insertString(PlainDocument.java:130)
at javax.swing.text.AbstractDocument.replace(AbstractDocument.java:669)
at javax.swing.text.JTextComponent.setText(JTextComponent.java:1669)
at org.apache.jmeter.gui.NamePanel.setName(NamePanel.java:85)
at org.apache.jmeter.gui.NamePanel.<init>(NamePanel.java:45)
at org.apache.jmeter.gui.AbstractJMeterGuiComponent.<init>(AbstractJMeterGuiComponent.java:78)
at org.apache.jmeter.visualizers.gui.AbstractListenerGui.<init>(AbstractListenerGui.java:32)
at org.apache.jmeter.visualizers.gui.AbstractVisualizer.<init>(AbstractVisualizer.java:127)
at kg.apc.jmeter.graphs.AbstractGraphPanelVisualizer.<init>(AbstractGraphPanelVisualizer.java:116)
at kg.apc.jmeter.graphs.AbstractOverTimeVisualizer.<init>(AbstractOverTimeVisualizer.java:13)
at kg.apc.jmeter.vizualizers.PerfMonGui.<init>(PerfMonGui.java:69)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at java.lang.Class.newInstance(Class.java:442)
at kg.apc.jmeter.PluginsCMDWorker.getGUIObject(PluginsCMDWorker.java:240)
at kg.apc.jmeter.PluginsCMDWorker.getGUIObject(PluginsCMDWorker.java:233)
at kg.apc.jmeter.PluginsCMDWorker.getGUIObject(PluginsCMDWorker.java:229)
at kg.apc.jmeter.PluginsCMDWorker.setPluginType(PluginsCMDWorker.java:73)
at kg.apc.cmdtools.ReporterTool.processParams(ReporterTool.java:97)
at kg.apc.cmdtools.PluginsCMD.processParams(PluginsCMD.java:63)
at kg.apc.cmdtools.PluginsCMD.processParams(PluginsCMD.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at kg.apc.cmd.UniversalRunner.main(UniversalRunner.java:174)
解决方法:
yum install glibc.i686 yum install glibc-devel yum install libstdc++.i686
9.另外一个监控cpu的工具(连接远程进程,没有测试通过。。。本地连接可以用)
监控内存及CPU等(jconsole)
最近逛论坛的时候,发现了一个比较好的监控内存CPU等的小工具,本着开源小工具多多益善的原则,记录一下。
打开这个小工具的步骤很简单,如果你已经配置好了Jmeter运行的环境,那么你也就不用去做其他的配置,直接 点击:开始——》运行——》输入cmd——》然后在出现的命令行界面输入“jconsole”即可弹出一个【java监视和管理控制台】,
将会弹出如下界面:
这里我们选择本地进程,并点击一下sun.tools.jconsole.JConsole这一行,然后点击连接,就可以查看我们的内存和CPU的使用情况了。
当然,我们要得到服务器的内存使用等信息,也可以选择 本地进程下面的远程进程,在文本框中输入我们需要测试的服务器的IP地址:端口,然后在下面输入用户名和密码,点击连接,看看会出现什么情况。
JMeter Properties 没有找到在那配置
- jmeterPlugin.perfmon.interval - metrics collection interval in milliseconds ---------- 指标收集时间间隔,单位是毫秒
- jmeterPlugin.perfmon.useUDP - true/false, enabling UDP connection try after failed TCP connection attempt--------值为 true 或 false,在 TCP 连接失败后是否尝试 UDP 连接
- jmeterPlugin.perfmon.label.useHostname - true/false, enable using "short" hostnames, default pattern is ([\w\-]+)\..*
- jmeterPlugin.perfmon.label.useHostname.pattern - string (escaped), regular expression to extract hostname (first group is matched)
- e.g. Default pattern would be: jmeterPlugin.perfmon.label.useHostname.pattern=([\w\-]+)\..*
- e.g. Pattern for EC2 us-east/west subdomain matching: jmeterPlugin.perfmon.label.useHostname.pattern=([\w\-]+\.us-(east|west)-[0-9]).*
- forcePerfmonFile - true/false, enabling it makes JMeter to write JTL file with perfmon metrics in the current directory
相关推荐
jmeter插件助手 jmeter-plugins-manager
而业务测试中又需要能有一个支持接口级的压测工具(基于dubbo的测试工具之前有造过一个轮子详见:https://blog.csdn.net/qq355667166/article/details/78914453),经过测试同学选型最终确认了采用jmeter+插件化...
"jmeter-plugins-manager-1.4下载" 提供的是JMeter的插件管理器,它极大地简化了JMeter第三方插件的安装和更新过程。下面将详细介绍JMeter、插件管理器及其使用方法。 1. JMeter简介: Apache JMeter是一款纯Java...
《JMeter管理插件——jmeter-plugins-manager-1.7.jar深度解析》 Apache JMeter是一款功能强大的性能测试工具,广泛应用于Web应用、FTP服务器、数据库等服务的压力测试。为了扩展JMeter的功能,社区开发了各种插件...
【JMeter】JMeter插件管理插件:jmeter-plugins-manager-1.3.jar Apache JMeter是一款开源的性能测试工具,广泛应用于Web应用、FTP服务器、数据库等服务的负载和压力测试。JMeter的强大之处在于其丰富的插件生态...
而JMeter Plugins则是一系列扩展JMeter功能的插件集合,提供了更丰富的测试元素和图表,使得测试工作更加灵活和高效。 在这个特定的版本“2.7.1”中,JMeter Plugins为Dubbo服务量身定制了一套解决方案。Dubbo是...
《JMeter Plugins Manager 1.4.jar 插件详解》 Apache JMeter 是一款广泛应用的开源性能测试工具,用于测试Web应用的负载和性能。在JMeter的生态系统中,插件扮演着重要的角色,能够扩展其功能,提高测试效率。其中...
jmeter插件,jmeter-plugins-redis-0.3.jar,通过jmeter自动取redis
首先,"jmeter-plugins-redis2"是一个专为JMeter设计的插件,它的核心功能在于实现了JMeter与Redis之间的数据写入和读取。Redis作为一款高性能的键值数据库,常被用于存储临时性数据,缓存或者消息队列,因此在接口...
在JMeter的生态系统中,"jmeter-plugins-manager-1.3"是其一个重要的辅助组件,它的作用在于简化JMeter插件的安装、更新和管理流程。 插件管理器的主要功能: 1. **方便安装**:无需手动下载和添加JMeter插件,...
在JMeter的生态系统中,JMeter Plugins Manager是一个非常重要的辅助工具,它使得用户能够方便地安装、管理和更新JMeter的各种插件。本文将详细介绍"jmeter-plugins-manager-1.3.jar.zip"的安装过程以及其功能和使用...
JMeter Plugins Manager 1.7 是一款专门为Apache JMeter设计的插件管理工具,它极大地简化了在JMeter中安装、更新和管理第三方插件的过程。JMeter是一款强大的性能测试工具,广泛应用于Web应用的压力测试、负载测试...
本文将深入探讨"jmeter-plugins-extras-libs-1.1.3"和"jmeter-plugins-standard-1.1.3"这两个版本的插件,解析它们的核心价值和应用场景。 首先,我们关注"jmeter-plugins-extras-libs-1.1.3"。这个名字中的"extras...
jmeter的dubbo插件,jmeter-plugins-dubbo-2.7.8-jar-with-dependencies.jar,适用于JMeter5.4.1版本,将解压后的文件jmeter-plugins-dubbo-2.7.8-jar-with-dependencies放在Jmeter安装目录下的\lib\ext文件夹中,...
JMeter Plugins Manager,正如其名,是一个用于管理JMeter插件的工具,它的主要功能是方便用户安装、更新和管理JMeter的各种插件。这个工具以`jmeter-plugins-manager-1.7.jar`的形式提供,用户可以直接从官网下载。...
jmeter-plugins-graphs-basic-2.0.jar是jmeter性能测试图形化显示插件
jmeter-plugins-manager是一个管理插件的插件,在plugins Managere中可以下载卸载Jmeter 的其他插件,相比以前版本的好处在于不用自己去下载其他插件的jar而且还需要放入ext文件夹中。
此时,JMeter Plugins Manager 1.6便应运而生,它是一款针对JMeter 5.4.1版本设计的插件管理工具,旨在帮助用户更加便捷地管理和安装各种JMeter插件,提升测试效率。 首先,我们来了解一下JMeter Plugins Manager的...
- `jmeter-plugins-dubbo-2.7.1-jar-with-dependencies.jar`:这是主插件文件,包含了JMeter Plugins for Dubbo的所有功能和其依赖的库。 - `jmeter-plugins-dubbo-2.7.1.jar`:可能是单独的插件库文件,方便用户...