JMeter 压测Server Agent无法监控资源问题,PerfMon Metrics Collector报Waiting for sample,Error loading results file - see file log, Can't accept UDP connections java.net.BindException: Address already in use 各种疑难杂症
此文章图片显示不出来,请查看博客园https://www.cnblogs.com/zdfbk/p/10107479.html
如何安装插件此博主已经说得很详细了。
https://www.cnblogs.com/saryli/p/6596647.html
但是需注意几点:
1.修改默认端口,这样可以避免掉一个问题。ServerAgent默认是4444端口,当然你可以修改,比如:./startAgent.sh –-udp-port 0 –-tcp-port 3450这样。
2.ServerAgent-2.2.1.zip下载下来之后拷贝到服务器上之后再进行解压。unzip ServerAgent-2.2.1.zip
我的安装目录是/usr/local/Jmeter/ServerAgent-2.2.3
(Jmeter从入门到MMP)
在使用Jmeter的性能监控插件时遇到了几个问题mark一下:
1.防火墙未关闭
2.端口号被占用。linux下输入命令 lsof -i:4444查看是否有被占用。如果有,使用kill -9 25601关闭
被占用会报如下错误
[root@business01 ServerAgent-2.2.3]# sh startAgent.sh
INFO 2019-01-25 15:52:36.544 [kg.apc.p] (): Binding UDP to 4444
ERROR 2019-01-25 15:52:36.582 [kg.apc.p] (): Can't accept UDP connections
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.DatagramChannelImpl.bind(DatagramChannelImpl.java:691)
at sun.nio.ch.DatagramSocketAdaptor.bind(DatagramSocketAdaptor.java:91)
at kg.apc.perfmon.PerfMonWorker.listenUDP(PerfMonWorker.java:144)
at kg.apc.perfmon.PerfMonWorker.startAcceptingCommands(PerfMonWorker.java:107)
at kg.apc.perfmon.AgentTool.processParams(AgentTool.java:72)
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:498)
at kg.apc.cmd.UniversalRunner.main(UniversalRunner.java:174)
INFO 2019-01-25 15:52:36.583 [kg.apc.p] (): Binding TCP to 4444
ERROR 2019-01-25 15:52:36.586 [kg.apc.p] (): Can't accept TCP connections
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:67)
at kg.apc.perfmon.PerfMonWorker.listenTCP(PerfMonWorker.java:135)
at kg.apc.perfmon.PerfMonWorker.startAcceptingCommands(PerfMonWorker.java:114)
at kg.apc.perfmon.AgentTool.processParams(AgentTool.java:72)
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:498)
at kg.apc.cmd.UniversalRunner.main(UniversalRunner.java:174)
3.未成功启动startAgent。下图是成功启动图。
启动时使用此命令nohup sh startAgent.sh &(注意后面有一个&符号,此命令是不中断在后台运行)
4.(这是主要问题)很多人都会出现如下问题Waiting for samples,
执行了就是不出图形结果。解决方法:写入一个文件。
但是不知道怎么写入文件呀,报Error loading results file - see file log错误。
解决方法:新建一个txt文件,并添加以下文本之后保存。
<?xml version="1.0" encoding="UTF-8"?>
<testResults version="1.2">
</testResults>
也可直接,D:\服务器性能监控数据.csv
成功效果图
弹出下图警告直接Overwrite existing file ,此警告是提示文件已存在。
从左到右的按钮意思是:添加到现有文件、不要开始、覆盖现有文件
5(这个也重要)如果有生成文件或者已创建的txt里有文字了,但是 还是显示Waiting for samples。那是因为你只发送了一条请求,执行时间少于1秒,所以线程组循环次数设置为永远吧!
2号问题报错的开始
[root@web01 ServerAgent-2.2.3]# sh startAgent.sh
INFO 2018-12-11 17:39:44.960 [kg.apc.p] (): Binding UDP to 4444
ERROR 2018-12-11 17:39:45.022 [kg.apc.p] (): Can't accept UDP connections
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.DatagramChannelImpl.bind(DatagramChannelImpl.java:691)
at sun.nio.ch.DatagramSocketAdaptor.bind(DatagramSocketAdaptor.java:91)
at kg.apc.perfmon.PerfMonWorker.listenUDP(PerfMonWorker.java:144)
at kg.apc.perfmon.PerfMonWorker.startAcceptingCommands(PerfMonWorker.java:107)
at kg.apc.perfmon.AgentTool.processParams(AgentTool.java:72)
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:498)
at kg.apc.cmd.UniversalRunner.main(UniversalRunner.java:174)
INFO 2018-12-11 17:39:45.024 [kg.apc.p] (): Binding TCP to 4444
ERROR 2018-12-11 17:39:45.029 [kg.apc.p] (): Can't accept TCP connections
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:67)
at kg.apc.perfmon.PerfMonWorker.listenTCP(PerfMonWorker.java:135)
at kg.apc.perfmon.PerfMonWorker.startAcceptingCommands(PerfMonWorker.java:114)
at kg.apc.perfmon.AgentTool.processParams(AgentTool.java:72)
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:498)
at kg.apc.cmd.UniversalRunner.main(UniversalRunner.java:174)
2号问题的结束
--udp-port 0 --tcp-port