relabel static configs

339 views
Skip to first unread message

petel...@googlemail.com

unread,
Feb 26, 2018, 10:16:13 AM2/26/18
to Prometheus Users
I have a number of targets in my Prometheus configuration as static configs

        - "blah.example.com:9182"
        - "blah1.example.com:9182"
        - "blah2.example.com:9182"

What I would like to do is to re-label the above so that instance just instance="blah2.example.com".

cheers

Pete


Brian Brazil

unread,
Feb 26, 2018, 10:29:48 AM2/26/18
to petel...@googlemail.com, Prometheus Users

 

cheers

Pete


--
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 prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/b93b7000-025b-4921-812d-250575c9782e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

petel...@googlemail.com

unread,
Feb 26, 2018, 3:27:14 PM2/26/18
to Prometheus Users
Thank Brian.

I did take a look at that when I was trying to get it to work earlier but with no success.

Are you able to provide an example that would work in my case?

Thanks

Pete

Simon Pasquier

unread,
Feb 27, 2018, 3:24:13 AM2/27/18
to petel...@googlemail.com, Prometheus Users
Something like this should do the work:

    relabel_configs:
    - source_labels: [__address__]
      regex: ([^:]+):\d+
      target_label: instance



Pete

--
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 prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.

petel...@googlemail.com

unread,
Feb 27, 2018, 4:12:43 AM2/27/18
to Prometheus Users
Thank you Simon - worked perfect and now understand this a bit more reading your example.

On Tuesday, 27 February 2018 08:24:13 UTC, Simon Pasquier wrote:
Something like this should do the work:

    relabel_configs:
    - source_labels: [__address__]
      regex: ([^:]+):\d+
      target_label: instance

On Mon, Feb 26, 2018 at 9:27 PM, peteleese84 via Prometheus Users <promethe...@googlegroups.com> wrote:
Thank Brian.

I did take a look at that when I was trying to get it to work earlier but with no success.

Are you able to provide an example that would work in my case?

Thanks

Pete

--
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 prometheus-use...@googlegroups.com.
To post to this group, send email to promethe...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages