2017-02-23 58 views
1

想發佈這個,因爲我搜索了很多,並找不到解決方案。Jmeter PerfMon指標收集在不同的jmx端口

使用jmeter和ServerAgent(2.2.1),我很難讓它在定製的JMX端口(不是4711)上工作。每的文檔,你需要指定,像這樣的參數:

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 

Source

所以,我想,使用

本地主機4444 JMX GC-時間:URL =本地主機:9080

這但導致服務器代理具有以下堆棧跟蹤

INFO 2017-02-23 20:53:51.352 [kg.apc.p](): Starting measures: jmx:gc-time:url=localhost\:9080 
ERROR 2017-02-23 20:53:51.445 [kg.apc.p](): Failed to get MX Bean data provider 
java.lang.IllegalArgumentException: Can't define JMX type 
     at kg.apc.perfmon.metrics.jmx.AbstractJMXDataProvider.getProvider(AbstractJMXDataProvider.java:48) 
     at kg.apc.perfmon.metrics.JMXMetric.<init>(JMXMetric.java:42) 
     at kg.apc.perfmon.metrics.AbstractPerfMonMetric.createMetric(AbstractPerfMonMetric.java:65) 
     at kg.apc.perfmon.PerfMonMetricGetter.setUpMetrics(PerfMonMetricGetter.java:138) 
     at kg.apc.perfmon.PerfMonMetricGetter.processCommand(PerfMonMetricGetter.java:63) 
     at kg.apc.perfmon.PerfMonMetricGetter.processNextCommand(PerfMonMetricGetter.java:101) 
     at kg.apc.perfmon.PerfMonWorker.read(PerfMonWorker.java:210) 
     at kg.apc.perfmon.PerfMonWorker.processCommands(PerfMonWorker.java:97) 
     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:483) 
     at kg.apc.cmd.UniversalRunner.main(UniversalRunner.java:175) 
ERROR 2017-02-23 20:53:51.446 [kg.apc.p](): Invalid metric specified: jmx 
java.lang.RuntimeException: Failed to get MX Bean data provider 
     at kg.apc.perfmon.metrics.JMXMetric.<init>(JMXMetric.java:45) 
     at kg.apc.perfmon.metrics.AbstractPerfMonMetric.createMetric(AbstractPerfMonMetric.java:65) 
     at kg.apc.perfmon.PerfMonMetricGetter.setUpMetrics(PerfMonMetricGetter.java:138) 
     at kg.apc.perfmon.PerfMonMetricGetter.processCommand(PerfMonMetricGetter.java:63) 
     at kg.apc.perfmon.PerfMonMetricGetter.processNextCommand(PerfMonMetricGetter.java:101) 
     at kg.apc.perfmon.PerfMonWorker.read(PerfMonWorker.java:210) 
     at kg.apc.perfmon.PerfMonWorker.processCommands(PerfMonWorker.java:97) 
     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:483) 
     at kg.apc.cmd.UniversalRunner.main(UniversalRunner.java:175) 
Caused by: java.lang.IllegalArgumentException: Can't define JMX type 
     at kg.apc.perfmon.metrics.jmx.AbstractJMXDataProvider.getProvider(AbstractJMXDataProvider.java:48) 
     at kg.apc.perfmon.metrics.JMXMetric.<init>(JMXMetric.java:42) 
     ... 14 more 

這個解決方案令人難以置信的是將url部分放在第一位。希望有人發現這個頁面和時間可以保存。

例如

URL =本地主機:9080:GC-時間

回答

0

我知道這個問題,你是不是使用JMX端口在JMeter的監控,但你可能會使用應用程序的端口,但JMeter的監視所需JMX端口。

驗證您的應用程序服務器是否有JMX端口詳細信息。以下是最常用的應用程序服務器,以及獲取端口詳細信息的步驟。

「雄貓」:在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 
+0

Madhu,感謝您的回覆,但是如果您閱讀完整的內容,我會在我的問題中發佈答案,作爲可能會有同樣問題的人員的參考 – joecoder