简体   繁体   English

标签Prometheus实例

[英]Label Prometheus Instances

I want be able to distinguish between the several servers that I'm reading from. 我希望能够区分正在读取的几台服务器。 But the only information that I have about the servers is the IP address, but what I wanted to have is a name for each server, instead of the IP. 但是,关于服务器的唯一信息就是IP地址,但是我想要的是每个服务器的名称而不是IP。

This is what I can see at the moment 这是我目前可以看到的

This is my prometheus.yml file: 这是我的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'

I tried this solution that Brian Brazil shows, but no luck. 我想这个解决方案,布赖恩巴西显示,但没有运气。

I saw this two one , two questions that are about the same problem, but no luck. 我看到了两个, 一个关于同一问题的两个问题,但是没有运气。

From what I saw the solution is something around relabel_configs but I'm not sure. 从我所看到的解决方案是围绕relabel_configs,但我不确定。

Remember that Prometheus is about services, not about hosts (see for example https://www.robustperception.io/one-agent-to-rule-them-all ). 请记住,Prometheus与服务有关,而不与主机有关(请参阅例如https://www.robustperception.io/one-agent-to-rule-them-all )。

But in any case I think you already have what you are looking for: job-name is transformed into the job label in all your metrics. 但是无论如何,我认为您已经找到了想要的东西:在所有指标中, job job-name都转换为job标签。 So in your grafana configuration, replace the label for the IP address (it seems you are using instance ) with job . 因此,在您的grafana配置中,将IP地址的标签(似乎您正在使用instance )替换为job

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM