2016-04-25 67 views
0

我想使用check_jmx插件來監視hornetq 2.4.0的實例,發現了nagios here。 我與螞蟻建造它後,我可以把它像這樣:
通過jmx檢查hornetq上的mbean值

./check_jmx -U service:jmx:rmi:///jndi/rmi://127.0.0.1:6000/jmxrmi -O java.lang:type=Memory -A HeapMemoryUsage -K used -I HeapMemoryUsage -J used -vvvv -w 4248302272 -c 5498760192 

並獲得此輸出:

JMX OK HeapMemoryUsage.used = 189815504 {致力於= 534773760; INIT = 536870912 ;最大= 956301312;使用= 189815504}



但如果我試試這個:

./check_jmx -U service:jmx:rmi:///jndi/rmi://127.0.0.1:6000/jmxrmi -O java.lang:type=MemoryPool,name="PS Eden Space" -A Usage -I Usage -K used -J used -vvv -w 4248302272 -c 5498760192 

我得到一個異常:

JMX CRITICAL java.lang:type=MemoryPool,name=PS connecting to java.lang:type=MemoryPool,name=PS by URL service:jmx:rmi:///jndi/rmi://192.168.9.39:6000/jmxrmijavax.management.InstanceNotFoundException: java.lang:type=MemoryPool,name=PS 
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1095) 
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:643) 
    at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:678) 
    at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1448) 
    at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76) 
    at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1312) 
    at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1404) 
    at javax.management.remote.rmi.RMIConnectionImpl.getAttribute(RMIConnectionImpl.java:641) 
    at sun.reflect.GeneratedMethodAccessor119.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:497) 
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323) 
    at sun.rmi.transport.Transport$1.run(Transport.java:200) 
    at sun.rmi.transport.Transport$1.run(Transport.java:197) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at sun.rmi.transport.Transport.serviceCall(Transport.java:196) 
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568) 
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826) 
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$64(TCPTransport.java:683) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
    at java.lang.Thread.run(Thread.java:745) 
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:276) 
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:253) 
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:162) 
    at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source) 
    at javax.management.remote.rmi.RMIConnectionImpl_Stub.getAttribute(Unknown Source) 
    at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.getAttribute(RMIConnector.java:903) 
    at org.nagios.JMXQuery.execute(JMXQuery.java:184) 
    at org.nagios.JMXQuery.main(JMXQuery.java:76) 

我可以利用這個工具來獲取價值或者是有一些其他的工具,我可以用得到的「PS伊甸園空間」?

回答

0

我終於想通了,這個工程:

java -cp jmxquery.jar org.nagios.JMXQuery -U service:jmx:rmi:///jndi/rmi://127.0.0.1:6000/jmxrmi -O "java.lang:type=MemoryPool,name=PS Old Gen" -A Usage -I Usage -K used -vvv -w 4248302272 -c 5498760192