On Thursday, 5 March 2020 18:30:54 UTC, Danny de Waard wrote:
>
> 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?
>
>
Yes, although before overwriting __address__ like that you'll want to pull
out the first part of __address__ to put in "instance".
Another possibility is if the instance label you want is always just the
first part of the DNS name, you can extract that. Then target
"lsrv1.server.nl:9100" will give "lsrv1" as the label.
- source_labels: [__address__]
regex: '([^.]+).*'
target_label: instance
replacement: '${1}'
> 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...??
>
Yes, that will work too. It does mean that you have to be careful that each
target group in the targets file contain only a single target.
--
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/faa797ef-0e5b-448e-bfca-dadf9243b539%40googlegroups.com.