> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-feat-cli-docs-generator.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Prometheus モニタリングを使用する

[Prometheus](https://prometheus.io/docs/introduction/overview/) を W\&B サーバーと一緒に使用します。Prometheus のインストールは [Kubernetes ClusterIP サービス](https://github.com/wandb/terraform-kubernetes-wandb/blob/main/main.tf#L225) として公開されます。

<Warning>
  Prometheus モニタリングは [セルフマネージドインスタンス](/ja/platform/hosting/hosting-options/self-managed) でのみ利用可能です。
</Warning>

以下の手順に従って、Prometheus メトリクスエンドポイント (`/metrics`) にアクセスします：

1. Kubernetes CLI ツールキットの [kubectl](https://kubernetes.io/docs/reference/kubectl/) を使用してクラスターに接続します。詳細については、Kubernetes の [クラスターへのアクセス](https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster/) ドキュメントを参照してください。

2. クラスターの内部アドレスを見つけます：

   ```bash theme={null}
   kubectl describe svc prometheus
   ```

3. Kubernetes クラスターで実行中のコンテナ内でシェルセッションを開始し、[`kubectl exec`](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands) を使用して、`<internal address>/metrics` エンドポイントにアクセスします。

   以下のコマンドをコピーしてターミナルで実行し、`<internal address>` を内部アドレスに置き換えます：

   ```bash theme={null}
   kubectl exec <internal address>/metrics
   ```

テストポッドが開始され、ネットワーク内の何かにアクセスするためだけに exec することができます：

```bash theme={null}
kubectl run -it testpod --image=alpine bin/ash --restart=Never --rm
```

そこから、ネットワークへのアクセスを内部に保つか、kubernetes nodeport サービスで自分で公開するかを選択できます。
