---
schema_version: "1"
id: 38b057589f2bc37b97bc5fbad11075257b8b251c4a510e5d6b8594788ab2066d
title: JMX Service
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/runtime-manager/jmx-service.md
canonical_url: https://docs.mulesoft.com/runtime-manager/jmx-service
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 6350430466aaadb2c3368699637c537e814e3c0e20a4afdaca0e747a8fe3bed5
description: MuleSoft Documentation Site
latest: true
---
---
product: Runtime Manager
keywords: agent, mule, esb, servers, monitor, notifications, external systems, third party, get status, metrics
---

# JMX Service

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

[![logo hybrid active](/mulesoft/current/en-us/_/img/icons/hybrid-cloud.svg "Hybrid")Hybrid](deployment-strategies#hybrid-deployments)[ ![logo server active](/mulesoft/current/en-us/_/img/icons/server-cloud.svg "Anypoint Platform PCE")Private Cloud Edition](deployment-strategies#anypoint-platform-private-cloud-edition)

The Runtime Manager agent JMX service allows you to track specific JMX metrics and publish them to
external services. The service can be configured to track specific beans and to change the frequency
with which it publishes their value.

> [!NOTE] Mule 4.x doesn’t expose beans to JMX.

## JMX Publishers

The JMX service sends all the gathered metrics to publishers, which in turn publish the metrics to
external monitoring tools. The service itself provides some example publishers for commonly-used
tools; furthermore, you can create your own publisher to suit your specific needs.

## Configure the JMX Service

### Operation: Retrieve Configuration

Retrieves the JMX service configuration.

**Request:**

GET <Runtime Manager Agent URL>/mule/agent/mule.agent.jmx.publisher.service HTTP/1.1

**Example:**

GET http://localhost:9999/mule/agent/mule.agent.jmx.publisher.service HTTP/1.1

**Response:**

```json
{
  "serviceHandlerTypes": ["java.util.List<com.mulesoft.agent.domain.monitoring.Metric>"],
  "injectedHandlers": [
    {
      "name": "com.mulesoft.agent.monitoring.publisher.CloudwatchMonitorPublisher",
      "path": "/mule/agent/cloudwatch.agent.monitor.publisher/configuration",
      "type": "java.util.List<com.mulesoft.agent.domain.monitoring.Metric>"
    },
    {
      "name": "com.mulesoft.agent.monitoring.publisher.GraphiteMonitorPublisher",
      "path": "/mule/agent/mule.agent.graphite.jmx.internal.handler/configuration",
      "type": "java.util.List<com.mulesoft.agent.domain.monitoring.Metric>"
    },
    {
      "name": "com.mulesoft.agent.monitoring.publisher.NagiosMonitorPublisher",
      "path": "/mule/agent/mule.agent.nagios.jmx.internal.handler/configuration",
      "type": "java.util.List<com.mulesoft.agent.domain.monitoring.Metric>"
    },
    {
      "name": "com.mulesoft.agent.monitoring.publisher.ZabbixMonitorPublisher",
      "path": "/mule/agent/mule.agent.zabbix.jmx.internal.handler/configuration",
      "type": "java.util.List<com.mulesoft.agent.domain.monitoring.Metric>"
    }
  ],
  "configurableFields": [
    {
      "name": "frequency",
      "valueType": "java.lang.Integer",
      "value": 15,
      "configurableType": "DYNAMIC"
    },
    {
      "name": "frequencyTimeUnit",
      "valueType": "java.util.concurrent.TimeUnit",
      "value": "MINUTES",
      "configurableType": "DYNAMIC"
    },
    {
      "name": "beans",
      "valueType": "[Lcom.mulesoft.agent.services.monitoring.JMXBean;",
      "value": [],
      "configurableType": "DYNAMIC"
    }
  ]
}
```

The response contains a list of the publishers currently loaded, as well as the configurable fields
of the service and their values (for more information on service configuration, see Administration
Service).

### Operation: Modify Configuration

This operation modifies the current configuration of the service.

**Request:**

```json
PATCH <Runtime Manager Agent URL>/mule/agent/mule.agent.jmx.publisher.service HTTP/1.1

{
  "<parameter>": "<value>",
}
```

**Example:**

```json
PATCH http://localhost:9999/mule/agent/myservice HTTP/1.1

{
  "frequencyTimeUnit": "SECONDS",
  "frequency": "150"
}
```

**Response (if successful):**

HTTP 200

### Add a New JMX Publisher

To add a new JMX publisher, implement the Runtime Manager agent `InternalMessageHandler` interface.

Your custom JMX publisher should meet the following requirements:

- It must be thread-safe.

- It must implement all publishing logic in the handle method defined in `InternalMessageHandler`.

#### Write Your JMX Publisher

```java
@Named("my.company.jmx.publisher")
@Singleton
public class MyJMXPublisher<T> extends InternalMessageHandler<List<Metric>>{

    boolean handle(List<Metric> metrics){
          // TODO handle message
    }

    @Override
    public void enable(boolean state) throws AgentEnableOperationException {
        // TODO: enable the Handler
    }

    @Override
    public boolean isEnabled() {
        // TODO: return Handler status
    }
}
```

The Metric class is a POJO that contains the following fields:

```java
/**
 * Time stamp when the metric was taken
 */
long timestamp;

/**
 * Name of the metric. In the case of a JXM metric it is the bean that was tracked + message
 */
String name;

/**
 * The numeric value of the metric
 */
Number value;
```

To add your new JMX publisher, just drop the JAR containing your classes under the `lib` folder
within the Runtime Manager agent plugin.

## See Also

- [Runtime Manager Agent API](https://anypoint.mulesoft.com/exchange/portals/anypoint-platform/f1e97bc6-315a-4490-82a7-23abe036327a.anypoint-platform/mule-agent-plugin-api/minor/1.1/pages/home/)
