3.6.4.3.2. 使用 Prometheus 收集 OpenShift Dev Spaces 服务器指标

使用 Prometheus 为 OpenShift Dev Spaces 服务器收集、存储和查询 JVM 指标:

先决条件

流程

  • 将 Prometheus 配置为从端口 8087 中提取指标。

    例 3.34. Prometheus 配置

    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
    1
    提取目标的速度。
    2
    重新检查记录和警报规则的速率。
    3
    Prometheus 监控的资源。在默认配置中,单个作业 che 会提取由 OpenShift Dev Spaces Server 公开的时间序列数据。
    4
    从端口 8087 中提取指标。

验证步骤

  1. http:// <prometheus-url>/metrics 中查看 Prometheus 控制台的指标
  2. http:// <prometheus-url>/graph 查询 Prometheus 控制台中的指标。如需更多信息,请参阅 使用表达式浏览器
  3. 通过查看 http:// <prometheus-url> /targets 上的目标端点,验证所有目标是否已启动