Monitoring

Check available services with WildFly

WildFly Services are classes which implement the interface org.jboss.msc.service.Service:

 

In order to query for active services from the CLI you can query the service-container as follows:

/core-service=service-container:dump-services()

As the list can be quite verbose, you can launch the CLI command in combination with the grep command from the shell. Here's for example how to query for the jgroups service to be active:

$ ./jboss-cli.sh --connect --command="/core-service=service-container:dump-services()" | grep jgroups

As an alternative, you could query the MBean jboss.msc:type=container,name=jboss-as via JMX as in the following example:

If you want to query the status programmatically, here's an example which shows how to query for the infinispan.server service using the getServicesStatus method:

JMXServiceURL address = new JMXServiceURL("service:jmx:remote+http://localhost:9990");

connector = JMXConnectorFactory.connect(address, null);

connection = connector.getMBeanServerConnection();

System.out.println("Connected to MBean Server");

ObjectName mbeanName = new ObjectName("jboss.msc:type=container,name=jboss-as");

//  Invoke operation

String opParams[] = {"jboss.infinispan.server"};

String opSig[] = {java.lang.String.class.getName()};
javax.management.openmbean.CompositeDataSupport out = (javax.management.openmbean.CompositeDataSupport) connection.invoke(mbeanName, "getServiceStatus", opParams, opSig);
System.out.println(out.get("stateName"));

Related articles available on mastertheboss.com

How to monitor JBoss CPU usage ?

  JBoss AS 7 users and WildFly can use JConsole in order to moni

How to monitor jboss graphically ?

  You’ve been using the JMX Console to access yourMBeans. In thi

How to monitor JBoss with snapshots?

  JBoss gives you the ability to capture data not only in real t

JBoss Alarm configuration

An Alarm indicates that an event (generally an error) has happene

Monitoring JBoss EJB Container

In this article we will show how easily you can write an Intercep

Monitor JBoss AS with Jolokia

Jolokia is a cool monitoring solution for accessing JMX MBeans re

Follow us on Twitter