---
schema_version: "1"
id: 0ea1c72a1abeb8cd7b34076fcd470a20d82f887a86109df181374e94d4da6ba0
title: CLI を使用したトラブルシューティング
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/gateway/1.10/flex-troubleshoot-admin-api.md
canonical_url: https://docs.mulesoft.com/jp/gateway/1.10/flex-troubleshoot-admin-api
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 2d56ffdefe2ee525000a135a5af9999556762fbd0c20b00251f94bc2e170cd65
description: MuleSoft Documentation Site
release: "1.10"
latest: false
---
# CLI を使用したトラブルシューティング

Anypoint Flex Gateway には、ゲートウェイの API インスタンス、サービス、設定、使用可能な拡張機能 (ポリシー) に関連した情報を照会できる ​`flexctl dump`​ CLI が含まれています。

たとえば、次のインラインスニペットは、デフォルトの名前空間で ​`jsonplaceholder-api`​ という単独の API インスタンスを定義します (名前空間名画明確に指定されていないため ​`default`​ のままになっています)。 また、このスニペットは ​`http-basic-authentication-flex`​ という内部ポリシーを定義しています。

<table><tbody><tr><td class="icon"><i class="fa icon-note" title="Note"></i></td><td class="content">Linux デプロイメントで ​<code>flexctl dump</code>​ を実行するには、ユーザーを ​<code>flex</code>​ ユーザーグループに追加するか、​<code>sudo</code>​ コマンドを使用して ​<code>flexctl dump</code>​ を実行します。詳細は、<a href="https://docs.mulesoft.com/jp/gateway/1.10/flex-troubleshoot-linux-permissions" class="xref page">Linux 権限のトラブルシューティング</a>を参照してください。</td></tr></tbody></table>

## [](#設定例)設定例

apiVersion: gateway.mulesoft.com/v1alpha1
kind: ApiInstance
metadata:
  name: jsonplaceholder-api
spec:
  address: http://0.0.0.0:8080
  services:
    jsonplaceholder:
      address: https://jsonplaceholder.typicode.com:443/
      routes:
        - rules:
            - path: /api(/users/.\*)
            - path: /api(/comments/.\*)
  policies:
    - policyRef:
        name: http-basic-authentication-flex
      config:
        username: chris
        password: admin

## [](#cli-を実行する)CLI を実行する

1. API インスタンス、サービス、設定、拡張機能の JSON 表現を確認するには、次のコマンドを実行します。
    
    ```ssh
    flexctl dump
    ```
    
    <table>
<tbody><tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="paragraph">
<p>Docker または Podman コンテナで実行している場合は、このコマンドをコンテナ自身の中で実行してください。</p>
</div>
</td>
</tr>
</tbody></table>
    
    このコマンドでは 4 つのファイルが出力されます。
    
    - `api-instances.json`
    - `services.json`
    - `configuration.json`
    - `extensions.json`
2. ファイル名が続く ​`cat`​ を実行し、JSON ファイルのコンテンツを表示します。
    
    - API インスタンス
    - サービス
    - 設定
    - Extensions (拡張機能)
    
    ```ssh
    cat api-instances.json
    ```
    
    `api-instances.json`​ ファイルのコンテンツは次のようになります。
    
    \[
       {
          "address":"http://0.0.0.0:8080",
          "kind":"ApiInstance",
          "name":"jsonplaceholder-api",
          "namespace":"default",
          "policies":\[
             {
                "config":{
                   "password":"admin",
                   "username":"chris"
                },
                "extension":{
                   "kind":"Extension",
                   "name":"http-basic-authentication-flex",
                   "namespace":"default"
                },
                "kind":"Policy",
                "name":"jsonplaceholder-api-http-basic-authentication-flex-1",
                "namespace":"default"
             },
             {
                "config":{
                   "destinationRef":{
                      "kind":"Service",
                      "name":"jsonplaceholder-api-jsonplaceholder",
                      "namespace":"default"
                   }
                }
                "extension":{
                   "kind":"Extension",
                   "name":"route",
                   "namespace":"default"
                },
                "kind":"Policy",
                "name":"jsonplaceholder-api-jsonplaceholder-route-1",
                "namespace":"default",
                "order":50,
                "rules":\[
                   {
                      "path":"/api(/users/.\*)"
                   },
                   {
                      "path":"/api(/comments/.\*)"
                   }
                \]
             },
             {
                "extension":{
                   "kind":"Extension",
                   "name":"envoy.filters.http.router",
                   "namespace":"default"
                },
                "kind":"Policy",
                "name":"envoy.filters.http.router",
                "namespace":"default",
                "order":2147483647
             }
          \]
       }
    \]
    
    ```ssh
    cat services.json
    ```
    
    `services.json`​ ファイルのコンテンツは次のようになります。
    
    \[
       {
          "address":"https://jsonplaceholder.typicode.com:443/",
          "kind":"Service",
          "name":"jsonplaceholder-api-jsonplaceholder",
          "namespace":"default"
       }
    \]
    
    ```ssh
    cat configuration.json
    ```
    
    `configuration.json`​ ファイルのコンテンツは次のようになります。
    
    {
      "internalMetrics": {
        "enabled": false
      },
      "logging": {},
      "platformConnection": {
        "anypoint": {
          "url": "https://anypoint.mulesoft.com"
        },
        "environment": {
          "cluster\_id": "4aa281e9-1a1d-4c56-8669-2d887b2e1938",
          "env\_id": "ad067f80-69ee-4abb-9d05-bec98ece1e20",
          "org\_id": "1caa0b9b-4f4d-43c4-a1b6-f925a8c77baa"
        },
        "logging": {
          "certificate": {
            "cert": "demo-local.pem",
            "key": "demo-local.key"
          },
          "url": "https://logging.ingestion.us-east-1.msap.io/ingestion/api/v1/logging"
        },
        "metering": {
          "certificate": {
            "cert": "demo-local.pem",
            "key": "demo-local.key"
          },
          "url": "https://metering.ingestion.us-east-1.msap.io/ingestion/api/v1/metering"
        },
        "mode": "offline",
        "monitoring": {
          "certificate": {
            "cert": "demo-local.pem",
            "key": "demo-local.key"
          },
          "url": "https://monitoring.ingestion.us-east-1.msap.io/ingestion/api/v1/monitoring"
        },
        "runtimeEvents": {
          "certificate": {
            "cert": "demo-local.pem",
            "key": "demo-local.key"
          },
          "url": "https://anypoint.mulesoft.com/apiruntime/v1/events"
        }
      },
      "resourceLimits": {
        "apiInstances": 100,
        "policies": 400
      },
      "sharedStorage": {},
      "version": "1.1.0"
    }
    
    ```ssh
    cat extensions.json
    ```
    
    `extensions.json`​ ファイルには Flex Gateway で使用できるすべてのポリシーが含まれます。このファイルのコンテンツは次のようになります。
    
    {
        "extends": \[
          {
            "kind": "Extension",
            "labels": {
              "flex.mulesoft.com/created-by": "flex-filesystem",
              "flex.mulesoft.com/managed-by": "flex-filesystem"
            },
            "name": "extension-definition",
            "namespace": "default"
          },
          {
            "kind": "Extension",
            "labels": {
              "flex.mulesoft.com/created-by": "flex-filesystem",
              "flex.mulesoft.com/managed-by": "flex-filesystem"
            },
            "name": "extension-qos",
            "namespace": "default"
          }
        \],
        "kind": "Extension",
        "labels": {
          "flex.mulesoft.com/created-by": "flex-filesystem",
          "flex.mulesoft.com/managed-by": "flex-filesystem"
        },
        "name": "header-injection-definition",
        "namespace": "default",
        "properties": \[
          {
            "name": "config",
            "properties": \[
              {
                "items": {
                  "name": "inboundHeaders",
                  "properties": \[
                    {
                      "name": "key",
                      "type": "stringOrDataweave"
                    },
                    {
                      "name": "value",
                      "type": "stringOrDataweave"
                    }
                  \],
                  "type": "object"
                },
                "name": "inboundHeaders",
                "type": "array"
              },
              {
                "items": {
                  "name": "outboundHeaders",
                  "properties": \[
                    {
                      "name": "key",
                      "type": "stringOrDataweave"
                    },
                    {
                      "name": "value",
                      "type": "stringOrDataweave"
                    }
                  \],
                  "type": "object"
                },
                "name": "outboundHeaders",
                "type": "array"
              }
            \],
            "type": "object"
          }
        \]
      }

## [](#冗長レベルの変更)冗長レベルの変更

`flexctl dump`​ CLI によって出力される情報の量を変更できます。たとえば、冗長性を ​`10`​ の値まで増やすには、次を使用して ​`flexctl dump`​ を実行します。

```ssh
flexctl dump -v 10
```

## [](#出力ディレクトリの変更)出力ディレクトリの変更

さらに、​`flexctl dump`​ で 4 つのファイルが出力されるディレクトリを変更できます。たとえば、​`/tmp`​ に出力するには、次を使用して ​`flexctl dump`​ を実行します。

```ssh
flexctl dump --output-directory /tmp
```