Prometheus - add target specific label in static_configs

后端 未结 5 539
迷失自我
迷失自我 2021-02-04 00:35

I have job definition as follows:

  - job_name: \'test-name\'
    static_configs:
      - targets: [ \'192.168.1.1:9100\', \'192.168.1.1:9101\', \'192.168.1.1:91         


        
5条回答
  •  我在风中等你
    2021-02-04 00:56

    I have the same question before. Here is my solution:

    1. use job_name as the group label
    2. add more target option to separate instance and add labels

    For you the code may like this:

      - job_name: 'development'
          static_configs:
          - targets: [ '192.168.1.1:9100' ]
            labels:
              service: '1'
          - targets: [ '192.168.1.1:9101' ]
            labels:
              service: '2'
    

提交回复
热议问题