我希望能够区分我正在阅读的几个服务器。但我对服务器的唯一信息是IP地址,但我想要的是每个服务器的名称,而不是IP。
This is what I can see at the moment
这是我的prometheus.yml文件:
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'eos-dev'
scrape_interval: 5s
metrics_path: '/actuator/prometheus'
static_configs:
- targets: ['292.268.3.326:8303']
labels:
job: 'dev'
- job_name: 'eos-test'
scrape_interval: 5s
metrics_path: '/actuator/prometheus'
static_configs:
- targets: ['272.41.27.342:8303']
labels:
job: 'test'
我尝试了Brian Brazil所展示的this解决方案,但没有运气。
我看到这两个one,two问题是关于同样的问题,但没有运气。
从我看到的解决方案是关于relabel_configs,但我不确定。
请记住,普罗米修斯是关于服务的,而不是关于主机的(参见例如https://www.robustperception.io/one-agent-to-rule-them-all)。
但无论如何,我认为你已经拥有了你想要的东西:job-name
在你所有的指标中被转换为job
标签。因此,在您的grafana配置中,用instance
替换IP地址的标签(看起来您使用的是job
)。