Prometheus 使用头盔向普罗米修斯添加刮削配置

Prometheus 使用头盔向普罗米修斯添加刮削配置,prometheus,kubernetes-helm,Prometheus,Kubernetes Helm,我正在尝试向我的prometheus配置中添加一个额外的scrape配置。对于安装,我使用头盔图表。因此,我创建了一个values.yaml文件 scrape_configs: - job_name: prometheus static_configs: - targets: - localhost:9090 - job_name: myapp static_configs: - targets: ["myapp-service:

我正在尝试向我的prometheus配置中添加一个额外的scrape配置。对于安装,我使用头盔图表。因此,我创建了一个
values.yaml
文件

scrape_configs:
  - job_name: prometheus
    static_configs:
      - targets:
        - localhost:9090
  - job_name: myapp
    static_configs: 
      - targets: ["myapp-service:3000"]
然后我执行了下面的命令

$> helm install -f ./values.yaml stable/prometheus 
这将使普罗米修斯旋转,我可以接近它。但是,当我检查配置或
目标时,
myapp
无关


我有种感觉,我忘记了一些东西,或者错误地将目标添加到普罗米修斯星图中。有什么建议吗?

您可以使用
extracrapeconfigs
指令添加额外的刮片设置

# adds additional scrape configs to prometheus.yml
# must be a string so you have to add a | after extraScrapeConfigs:
# example adds prometheus-blackbox-exporter scrape config

extraScrapeConfigs: |
   - job_name: 'prometheus-blackbox-exporter'
     metrics_path: /probe
     params:
       module: [http_2xx]
     static_configs:
       - targets:
         - https://example.com
     relabel_configs:
       - source_labels: [__address__]
         target_label: __param_target
       - source_labels: [__param_target]
         target_label: instance
       - target_label: __address__
         replacement: prometheus-blackbox-exporter:9115

在将其添加到
值.yml
时,请仔细检查缩进。它必须是root的子对象。

您将刮片作业添加到了哪个部分?Helm图表中应该有一个prometheus.yml部分,您可以将作业粘贴到其中,不过请确保正确缩进,因为缩进比kubernetes部署文件中的缩进更深。我写过在不同的设置中查找/更新你的prometheus.yml文件,其中包括一个Helm部分;这篇文章是关于远程存储的,但是添加临时作业的过程应该是相同的。我认为你是对的。我刚刚添加了
serverFiles:
作为
prometheus.yml
的父级,它可以正常工作。Thnx!