简体   繁体   中英

Monitoring on OSGi/Equinox

We are using Equinox as runtime for our app. The OSGi modularity is great, but there's one thing I miss from the JBoss days: the monitoring facilities. JMX is the standard for monitoring in the JVM but Equinox doesn't seem to provide much built-in support for it.

Besides the Equinox Resource Monitoring project, which seems to be stale since 2007 (and didn't move out of incubation), what are the options?

What are other OSGi/Equinox adopters using for monitoring OSGi-based applications? What about other OSGi implementations? This is important enough to trigger a migration in case eg Felix+Karaf would offer better monitoring support.

There are a few options available. Gemini Management provides an implementation of an OSGi Standard for JMX monitoring of frameworks.

If you'd like to monitor the Servlet environment that you need to look at the options provided by the Servlet engine. We include Jetty in Gyrex and it provides a couple of options. We also added a few more JMX beans to measure the average request time, information about the last error and more.

Implementing your own JMX beans is actually not difficult. You can call ManagementFactory.getPlatformMBeanServer().registerMBean(...) from anywhere in your code to register the beans. Have a look at our service tracker implementation which registers an JMX monitoring bean for every registered service object of a particular type.

I recommend using Apache Karaf. You can use it with Felix or Equinox. It provides a lot of monitoring features. Just start up karaf and connect with Jconsole. Besides JMX it has the Felix Webconsole and a great command line that can also be used via ssh.

I found this thread when googling for equinox + JMX. Since this thread is from 2012 and others may come around this in the future its time to add another solution which fitted well for me.

You could easily use Aries JMX . Below you can find a wrap up from Aries documentation. To do so add

  • A simple Bundle

     import java.lang.management.ManagementFactory; import javax.management.MBeanServer; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; public class Activator implements BundleActivator { public void start(BundleContext context) throws Exception { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); context.registerService(MBeanServer.class.getName(), mbs, null); } public void stop(BundleContext context) throws Exception {} } } 
  • Aries JMX Bundle

  • Aries JMX API Bundle
  • Aries Util Bundle

as a result it is possible to access the Equinox Container via eg JConsole.

Apache Felix Web Console is a pretty powerful tool for monitoring the state of your OSGi container. It can also be run within Equinox.

See http://felix.apache.org/site/apache-felix-web-console.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM