如何配置 Prometheus 在 GCP 上抓取新的 CE?

问题描述 投票:0回答:2

我正在尝试在 GCP 上的计算引擎上配置 Prometheus 实例,以从多个计算引擎实例中获取指标。关于这一点,一切都应该是标准的,但我应该如何配置 Prometheus 以自动区分新的计算引擎实例? 目前我没有使用 K8s。

例如: 我有 2 个使用 Prometheus 监控的 nginx 实例。如果我添加一个新的 nginx 实例,我希望自动在 Prometheus 上获得新的指标。

谢谢

google-cloud-platform prometheus prometheus-node-exporter
2个回答
1
投票

我不知道这是否能解决你的问题。

我在所有实例上安装了节点导出器,并为其配置了自动发现服务。最重要的是,一些实例有自己的 app_exporter,可以在另一个端口 (9854) 上发布应用程序特定的指标。

我做了什么:
我为该端口添加了一个额外的 GCP 发现抓取作业:

  scrape_configs:
    # Dynamic GCP service discovery for extra app-metrics
    - job_name: 'gcp_solr_discovery'
      metrics_path: "/admin/metrics"
      gce_sd_configs:
         # Europe West 1
       - project: "your-project-here"
         zone: "europe-west1-b"
         port: 9854
       - project: "your-project-here"
         zone: "europe-west1-c"
         port: 9854

这将使 GCP 服务发现查询这些端口,无论虚拟机是否有节点导出器,并且您的实例将被动态添加。


0
投票

确切地说,prometheus for zone/project没有这样的文档

© www.soinside.com 2019 - 2024. All rights reserved.