Monitoring Mendix using JMX

Last update: Edit

The following is only relevant if you run Mendix on-premises. If you do, you probably have standard monitoring tooling that you use to monitor all your applications.

For java applications most monitoring tools provide a way to hook into JMX to get information about the application. The following describes how you can use JMX to get information on your Mendix application.

Mendix doesn’t provide any runtime or application specific MBeans, which means that without writing your own MBeans you will only be able to monitor generic JVM statistics. In this post i’ll describe how you enable JMX on your Mendix runtime. I’ll also decribe how you can write custom MBeans to expose Mendix runtime information and application specific information.

1. Starting the Mendix runtime with JMX enabled

To enable JMX on your Mendix runtime you can use the following javaopts to the m2ee.yaml for your Mendix runtime:

javaopts: [

"-Dfile.encoding=UTF-8", "-XX:MaxPermSize=64M", "-Xmx128M", "-Xms128M",









2. MBean exposing generic Mendix statistics

The simplest way to expose management information is by writing a MBean interface and a Java class which implements the interface. You can define getters and setter, but you can also define methods which can be called from generic management tooling. I’ve used this for example to tell a running application to reload its configuration file.

  1. Example of an interface which contains getters for some generic Mendix information,

    package jmx.actions;
    public interface MxStatsMBean {
    public int getMaximumNumberConcurrentUsers() throws Exception;
    public int getActionQueueSize();
    public int getActiveActionCount();
    public int getScheduledActionCount();
    public long getNumberConcurrentSessions();
    public long getCurrentUserCount();
    public long getCompletedActionCount();
    public long getNamedUserCount();
  2. And here is the implementation, The methods just call the Mendix Core class, and return the value:

    package jmx.actions;
    import com.mendix.core.Core;
     public class MxStats implements MxStatsMBean {
     public int getMaximumNumberConcurrentUsers() throws Exception {
     return Core.getMaximumNumberConcurrentUsers();
     public int getActionQueueSize(){
     return Core.getActionQueueSize();
     public int getActiveActionCount(){
     return Core.getActiveActionCount();
     public int getScheduledActionCount(){
     return Core.getScheduledActionCount();
     public long getNumberConcurrentSessions(){
     return Core.getNumberConcurrentSessions();
     public long getCurrentUserCount(){
     return Core.getConcurrentUserCount(true);
     public long getCompletedActionCount(){
     return Core.getCompletedActionCount();
     public long getNamedUserCount(){
     return Core.getNamedUserCount();
  3. Next, you’re able to see the result of the values exposed by this MBean in JConsole

3. MBean exposing application specific statistics

You can use the same approach, with an Interface and implementation class, to also expose application specific information. Here’s a different approach: one that exposes a dynamic set of values. You can do the same with methods, but the example only shows attributes to retrieve values. The idea is that you will have a Java Action that you can call in a microflow, where you expose arbitrary key, value pairs.