I am using Nagios for monitoring - and looking at 开发者_StackOverflow中文版NPRE for various monitoring on a given box. I have some java processes - would be nice to "peek into them" via JMX etc.. I can't see a way to do this without starting up a JVM and connecting remotely?
Any ideas?
I believe you can connect to JMX services via RMI-IIOP, which I believe is CORBA for Java. I believe this means you can use any COBRA client to connect to a RMI-IIOP Java service. Check out JBoss IIOP, which does what you want, I believe, only it's JBoss-specific.
Perhaps it might be easier to simply wrap the JMX services you wanna export using JAX-WS or JAX-RS (i.e., as web services)? Then you can use plain ol' HTTP to access what you want.
In fact, it seems someone has done exactly that! I presume you would like access to something like:
http://<host>:<port>/rest/jmx/java.lang:type=Memory/NonHeapMemoryUsage/commited
The entire project is available at https://opendmk.dev.java.net/contributions/rest-adaptor/readme.html :
Restful JMX Adaptor
This Project OpenDMK contribution offers an HTTP access to JMX information in a RestFul way. An article published in the JMX NetBeans blog, covers in detail the approach.
Another (the same?) project is available at https://ws-jmx-connector.dev.java.net/
For monitoring JMX with Nagios jmx4perl is the perfect solution since it comes already with a feature rich Nagios Plugin check_jmx4perl. It uses Jolokia, an agent which bridges JMX via JSON/HTTP and has advanced features like fine grained security or bulk request which are not available for classical JSR-160 connectors. It is also being actively developed, whereas the REST approaches described above seem to be stuck in the year 2008 (this was also a reason for starting jmx4perl in May 2009). BTW, JSR-262 "Web Services Connector for Java Management Extensions (JMX) Agents" has unfortunately the status "inactive" since some time, so I don't expect much progress from this side.
精彩评论