---
schema_version: "1"
id: 08bc083256cde18747312e7f1305adfc535b9eed3c3af18ea0532e0c08056871
title: JMX サービス
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/runtime-manager/jmx-service.md
canonical_url: https://docs.mulesoft.com/jp/runtime-manager/jmx-service
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 4e8b7d09a08518e131b0cd363c61f1ded1e2883c283ee7f5808db36dd059204d
description: MuleSoft Documentation Site
latest: true
---
# JMX サービス

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

Runtime Manager エージェント JMX サービスを使用すると、特定の JMX メトリクスを追跡し、それらを外部サービスにパブリッシュできます。サービスを設定して、特定の bean を追跡したり、値をパブリッシュする頻度を変更したりできます。

<table><tbody><tr><td class="icon"><i class="fa icon-note" title="Note"></i></td><td class="content">Runtime Manager エージェントでは、Mule 3.x のみで ​<code>mule.agent.jmx.publisher.service</code>​ を使用した JMX bean の監視をサポートしています。 Mule 4.x では、bean が JMX に公開されません。</td></tr></tbody></table>

## [](#jmx-パブリッシャー)JMX パブリッシャー

JMX サービスは、収集したすべてのメトリクスをパブリッシャーに送信し、パブリッシャーはメトリクスを外部監視ツールにパブリッシュします。サービス自体に、一般的に使用されるツール用のパブリッシャー例がいくつか用意されています。さらに、ニーズに合わせて独自のパブリッシャーを作成できます。

## [](#jmx-サービスの設定)JMX サービスの設定

### [](#操作-設定の取得)操作: 設定の取得

JMX サービス設定を取得します。

**要求:**

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

**例:**

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

**応答:**

```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"
        }
    ]
}
```

応答には、現在読み込まれているパブリッシャーのリストに加え、サービスの設定可能な項目とその値が含まれています (サービスの設定についての詳細は、「管理サービス」を参照してください)。

### [](#操作-設定の変更)操作: 設定の変更

次の操作は、サービスの現在の設定を変更します。

**要求:**

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

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

**例:**

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

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

**応答 (成功した場合):**

HTTP 200

### [](#新しい-jmx-パブリッシャーの追加)新しい JMX パブリッシャーの追加

新しい JMX パブリッシャーを追加するには、Runtime Manager エージェントの ​`InternalMessageHandler`​ インターフェースを実装します。

カスタム JMX パブリッシャーは、次の要件を満たす必要があります。

- スレッドセーフである。
- `InternalMessageHandler`​ で定義されたハンドラーメソッドのすべてのパブリッシュロジックを実装している。

#### [](#jmx-パブリッシャーの記述)JMX パブリッシャーの記述

```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
    }
}
```

メトリクスクラスは次の項目を含む POJO です。

```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;
```

新しい JMX パブリッシャーを追加するには、クラスを含む JAR を Runtime Manager エージェントプラグイン内の ​`lib`​ フォルダーに置きます。

## [](#関連情報)関連情報

- [Runtime Manager エージェント 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/)