16.2. 配置 Prometheus 服务器以从 Apache Karaf 容器中提取公开的指标

要让 Prometheus 服务器从 Apache Karaf 容器中提取指标,必须将公开指标的端点添加到 Prometheus 配置文件的 targets 属性中。

流程

  1. 进入 Prometheus 安装目录中的 /prometheus.yml 配置文件。
  2. 添加 Apache Karaf 端点以提取:

    scrape_configs:
      - job_name: 'prometheus'
    
        # metrics_path defaults to '/metrics'
        # scheme defaults to 'http'.
        static_configs:
        - targets: ['localhost:9779']