3.6.4.3.2. Prometheus を使用した OpenShift Dev Spaces メトリクスの収集
Prometheus を使用して、OpenShift Dev Spaces サーバーの JVM メトリクスを収集、保存、および照会するには、以下を実行します。
前提条件
-
OpenShift Dev Spaces は、ポート
8087
にメトリクスを公開しています。Enabling and exposing OpenShift Dev Spaces server JVM metrics を参照してください。 -
Prometheus 2.26.0 以降が動作している。Prometheus コンソールは、対応する
service
とroute
のあるポート9090
で実行されています。Prometheus を初めて実行するための手順について参照してください。
手順
ポート
8087
からメトリクスを収集するように Prometheus を設定します。例3.34 Prometheus の設定
Copy to Clipboard Copied! Toggle word wrap Toggle overflow apiVersion: v1 kind: ConfigMap metadata: name: prometheus-config data: prometheus.yml: |- global: scrape_interval: 5s evaluation_interval: 5s scrape_configs: - job_name: 'che' static_configs: - targets: ['[che-host]:8087']
apiVersion: v1 kind: ConfigMap metadata: name: prometheus-config data: prometheus.yml: |- global: scrape_interval: 5s
1 evaluation_interval: 5s
2 scrape_configs:
3 - job_name: 'che' static_configs: - targets: ['[che-host]:8087']
4
検証手順
-
http://<prometheus-url>/metrics
にある Prometheus コンソールでメトリクスを表示します。 -
http://<prometheus-url>/graph
から Prometheus コンソールでメトリクスを照会します。詳細は、Using the expression browser を参照してください。 -
http://<prometheus-url>/targets
にあるターゲットエンドポイントを表示して、すべてのターゲットが稼働していることを確認します。