Thanks, Brian. I'm spinning my wheels here and getting all sorts of errors
in Prometheus with different relabeling configurations. I've been reading
on the topic but relabeling is still a bit obscure to me.
- targets:
- server1:9117;ad-1;domain-1;emea-1
- server2:9117;ad-2;domain-2;emea-1
relabel_configs:
- source_labels: ['__address__']
regex: '(.*);(.*);(.*);(.*)'
target_label: 'instance'
replacement: '$1'
metric_relabel_configs:
- source_labels: ['__address__']
regex: '(.*);(.*);(.*);(.*)'
target_label: 'ad'
replacement: '$2'
- source_labels: ['__address__']
regex: '(.*);(.*);(.*);(.*)'
target_label: 'dom'
replacement: '$3'
- source_labels: ['__address__']
regex: '(.*);(.*);(.*);(.*)'
target_label: 'reg'
replacement: '$4'
On Friday, May 22, 2020 at 11:46:28 PM UTC-7, Brian Candler wrote:
>
> It depends where the 'ad', 'dom', 'reg' information comes from. You can
> embed that information in the target, e.g.
>
> - targets:
> - server1:9117/ad-1/domain-1/emea-1
> - server2:9117/ad-2/domain-2/emea-1
>
> and then use rewriting rules to extract each of the parts in turn into
> separate labels. But to my eye that's less clear than doing the simple
> thing already suggested.
>
> There's a more compact way of writing YAML if you prefer:
>
> - targets: [server1:9117]
> labels: {ad: ad-1, dom: domain-1, reg: emea-1}
>
> - targets: [server2:9117]
> labels: {ad: ad-2, dom: domain-2, reg: emea-1}
>
>
--
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/6c204ffe-8f79-4d6e-9442-cbc859d6b5fa%40googlegroups.com.