If i reads the article correct i should be able to use this relabel:
      - source_labels: [__address__]
        regex: '(.+)/(.+)'  # name/address
        target_label: __address__
        replacement: '${2}'
and fill in lsrv1/lsrv1.server.nl:9100 in my target line?

Or should i also use a node_targets.yml to simplify all this

[
    {
        "targets": [ "senta04.mydomain.com:9100" ],
        "labels": {
            "instance": "senta04"
        }
    },{

      "targets": [ "senta02.mydomain.com:9100" ],
      "labels": {
          "instance": "senta02"
      }
  }
]

Almost looks when if i use this yml i dont have to relabel...??

Op donderdag 5 maart 2020 18:54:50 UTC+1 schreef Brian Candler:
>
> On Thursday, 5 March 2020 17:20:01 UTC, Danny de Waard wrote:
>>
>> I have been reading all across the internet for a way to relabel my 
>> instance name.
>> Now all my dashboard have long instance names like lsrv1.server.nl:9100
>>
>> I would like to have that reduced to lsrv1
>>
>
> The blog post at 
> https://www.robustperception.io/controlling-the-instance-label describes 
> this - at least, getting rid of the port.
>
> You can also make the instance label a short name "lsrv1" whilst scraping 
> target with DNS name "lsrv1.server.nl" or IP address "1.2.3.4". To do 
> this, make a target which contains both parts, e.g. "name/address", and use 
> relabelling to splitting the name into the "instance" label and the 
> address:port into the "__address__" label.  See:
> https://groups.google.com/d/msg/prometheus-users/VafEFQQKdWc/YrChiAePBQAJ
> https://github.com/candlerb/netbox-prometheus#targets
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/720441bc-4d8a-4889-9aa0-9c795fb87e14%40googlegroups.com.

Reply via email to