maasg
maasg

Reputation: 37435

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 e.g. Felix+Karaf would offer better monitoring support.

Upvotes: 3

Views: 4343

Answers (4)

Achim
Achim

Reputation: 175

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 e.g. JConsole.

Upvotes: 1

Christian Schneider
Christian Schneider

Reputation: 19606

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.

Upvotes: 2

Gunnar
Gunnar

Reputation: 2359

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.

Upvotes: 3

Ilya Shinkarenko
Ilya Shinkarenko

Reputation: 2182

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

Upvotes: 0

Related Questions