0

我已经配置了 Prometheus 服务发现:

普罗米修斯.yml:

- job_name: 'GP'
    ec2_sd_configs:
      - region: us-west-1
        access_key: ...
        secret_key: ...
        port: 9100
    relabel_configs:
      - source_labels: [__meta_ec2_tag_Name]
        regex: GP-.*
        action: keep
        # Use the instance ID as the instance label
      - source_labels: [__meta_ec2_instance_id]
        target_label: instance

并自动发现两个实例:

在此处输入图像描述

两个实例也返回指标:

# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 7.296e-06
go_gc_duration_seconds{quantile="0.25"} 2.2649e-05
go_gc_duration_seconds{quantile="0.5"} 3.5584e-05
go_gc_duration_seconds{quantile="0.75"} 6.745e-05
go_gc_duration_seconds{quantile="1"} 0.010453099
go_gc_duration_seconds_sum 0.280941774
go_gc_duration_seconds_count 1405
...

然后我添加了 Prometheus 作为数据源并导入了 1860 仪表板,但是当 GP 被列为作业时没有显示任何数据:

在此处输入图像描述

为了测试目的,我还硬编码了 Prometheus Job:

  - job_name: 'nodeexporter'
    scrape_interval: 5s
    static_configs:
      - targets: ['xx.xx.xx.xx:9100']

有了这个,它可以工作:

在此处输入图像描述

我究竟做错了什么?

此外,主机值对于两者GP和始终相同nodeexporter。另外,Prometheus 的其他三个工作(cadvisor、prometheus、pushgateway)都没有暴露在下拉列表中,这也令人困惑

4

0 回答 0