Jmeter PerfMon Metrics集合在不同的jmx端口上

时间:2017-02-23 21:19:03

标签: java jmeter performance-testing

想发布这个,因为我搜索了很多,但找不到解决方案。

使用jmeter和ServerAgent(2.2.1),我无法在自定义JMX端口(而非4711)上运行它。根据文档,您需要指定如下参数:

let context = (NSApplication.shared().delegate as! AppDelegate).managedObjectContext

Source

所以我尝试使用

localhost 4444 JMX gc-time:url = localhost:9080

然而,这导致服务器代理具有以下堆栈跟踪

By default the Server Agent will try to connect to JMX server at localhost with port 4711. If you started JMX server at different host/port or using authentication with username/password, please, use following additional parameters:

url=<hostname>\:<port>
user=<username>
password=<password>
Available JMX metric types:

gc-time - time spent in garbage collection, milliseconds (used method)
memory-usage - heap memory used by VM, bytes (method used)
memory-committed - heap memory committed by VM, bytes (method used)
memorypool-usage - heap memory pool usage, bytes (method used)
memorypool-committed - heap memory pool committed size, bytes (method used)
class-count - loaded class count in VM (used method)
compile-time - time spent in compilation, milliseconds (used method)
Examples:

gc-time - monitor GC time at localhost:4711
memory-usage:url=somehost.com\:4715 - use alternative hostname/password
class-count:url=somehost.com\:4715:user=apc:password=SecurityPlease123 - some secure setup access

令人难以置信的是,解决方案是将网址部分放在第一位。希望有人找到这个页面,并且可以保存时间。

e.g。

URL =本地主机:9080:GC-时间

1 个答案:

答案 0 :(得分:0)

我知道这个问题,您没有在JMeter监控中使用JMX端口,但您可能正在使用应用程序端口,但JMeter监控需要JMX端口。

验证应用程序服务器是否有JMX端口详细信息。以下是最常用的应用程序服务器以及获取端口详细信息的步骤。

“Tomcat”:在catalina.sh或setenv.sh文件中,查找“Dcom.sun.management.jmxremote.port”= 9004,如果您没有看到此条目尝试配置您的tomcat服务器通过以下链接 https://www.mkyong.com/tomcat/jconsole-jmx-remote-access-on-tomcat/

Jboss:在standalone.conf中查找“Dcom.sun.management.jmxremote.port”= 9004,如果您没有看到此条目尝试通过以下链接配置您的tomcat服务器 Connect to JBoss 7 using VisualVM

一旦有了JMX端口,JMeter就能监控。

Monitoring Demo App:


     1. Start you JMeter instance
     2. Start java application (New instance jmeter, cd {JMeter_home}/bin) using following command 

        java -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=6969 -Dcom.sun.management.jmxremote.rmi.port=6969 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -jar ApacheJMeter.jar

    3. Download jmeter_mon.jmx file from Github using [link][1]
    4. Open "jmeter_mon.jmx" file from JMeter instance 1.
    5. Start Server monitoring script sh {ServerAgent}/startAgent.sh 
    6. Run the Jmeter