jmeter性能监控

1、下载插件:JMeterPlugins-Standard-1.4.0.zip , JMeterPlugins-Extras-1.4.0.zip,ServerAgent-2.2.3.zip;
2、JMeterPlugins-Standard-1.4.0.zip , JMeterPlugins-Extras-1.4.0.zip解压取jar包放到apache-jmeter-4.0\lib\ext目录下;
3、ServerAgent-2.2.1.zip解压放到被监控机器上,解压,启动:双击startAgent.bat;或运行 sh startAgent.sh
4、打开jmeter5.0,可选择插件jp@gc - PerfMon Metrics Collector和jp@gc - Transactions per Second,输入(被测机器IP/host)启动端口默认为4444
5、执行脚本
报错

2019-08-06 14:39:49,458 INFO o.a.j.e.StandardJMeterEngine: Running the test!
2019-08-06 14:39:49,465 INFO o.a.j.s.SampleEvent: List of sample_variables: []
2019-08-06 14:39:49,465 INFO o.a.j.s.SampleEvent: List of sample_variables: []
2019-08-06 14:39:49,476 ERROR o.a.j.JMeter: Uncaught exception: 
java.lang.NoSuchMethodError: org.apache.jmeter.samplers.SampleSaveConfiguration.setFormatter(Ljava/text/DateFormat;)V
	at kg.apc.jmeter.JMeterPluginsUtils.doBestCSVSetup(JMeterPluginsUtils.java:272) ~[JMeterPlugins-Extras.jar:?]
	at kg.apc.jmeter.perfmon.PerfMonCollector.setupSaving(PerfMonCollector.java:140) ~[JMeterPlugins-Standard.jar:?]
	at kg.apc.jmeter.perfmon.PerfMonCollector.testStarted(PerfMonCollector.java:117) ~[JMeterPlugins-Standard.jar:?]
	at org.apache.jmeter.reporters.ResultCollector.testStarted(ResultCollector.java:350) ~[ApacheJMeter_core.jar:5.0 r1840935]
	at kg.apc.jmeter.vizualizers.CorrectedResultCollector.testStarted(CorrectedResultCollector.java:28) ~[JMeterPlugins-Extras.jar:?]
	at org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfStart(StandardJMeterEngine.java:215) ~[ApacheJMeter_core.jar:5.0 r1840935]
	at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:384) ~[ApacheJMeter_core.jar:5.0 r1840935]
	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91]

结论:jmeter5.0不支持JMeterPlugins-Standard和JMeterPlugins-Extras插件
改为jmeter3.1,以上同样操作,执行脚本

ERROR - kg.apc.jmeter.perfmon.PerfMonCollector: Problems creating connector java.net.ConnectException: Connection timed out: connect
	at java.net.DualStackPlainSocketImpl.connect0(Native Method)
	at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at java.net.Socket.connect(Socket.java:538)
	at kg.apc.perfmon.client.TransportFactory.TCPInstance(TransportFactory.java:91)
	at kg.apc.jmeter.perfmon.PerfMonCollector.getConnector(PerfMonCollector.java:244)
	at kg.apc.jmeter.perfmon.PerfMonCollector.initiateConnector(PerfMonCollector.java:229)
	at kg.apc.jmeter.perfmon.PerfMonCollector.initiateConnectors(PerfMonCollector.java:177)
	at kg.apc.jmeter.perfmon.PerfMonCollector.testStarted(PerfMonCollector.java:130)
	at org.apache.jmeter.reporters.ResultCollector.testStarted(ResultCollector.java:348)
	at kg.apc.jmeter.vizualizers.CorrectedResultCollector.testStarted(CorrectedResultCollector.java:28)
	at org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfStart(StandardJMeterEngine.java:204)
	at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:325)
	at java.lang.Thread.run(Thread.java:745)

结论:无法连接4444端口,检查是否开启此端口
解决:重启serverAgent服务,尝试用telnet连接,检测到无法连接后,尝试将4444端口加入防火墙

firewall-cmd --list-all-zones
firewall-cmd --zone=public --add-port=4444/tcp --permanent
firewall-cmd --reload

经过一系列操作后仍无法telnet通
尝试修改连接的端口号java -jar ./CMDRunner.jar --tool PerfMonAgent --udp-port 5567 --tcp-port 5567
此时仍无法连接
再次使用sh startAgent.sh
jmeter连接成功。。。。但是telnet仍然不成功。。。。。无解

你可能感兴趣的:(jmeter)