Problematic relabel_configs

588 views
Skip to first unread message

yac...@gmail.com

unread,
Oct 12, 2015, 3:36:06 PM10/12/15
to Prometheus Developers
Hello there,

I've decided to use collectd_exporter, to bridge in data that node_exporter doesn't yet know about. My collectd_exporter's /metrics seem to be populated correctly, showing data like this:

"""
collectd_cpu{cpu="0",instance="boxoob",type="idle"} 781937
collectd_cpu{cpu="0",instance="boxoob",type="interrupt"} 0
collectd_cpu{cpu="0",instance="boxoob",type="nice"} 1726
"""

In prometheus, I've tried to use relabel_configs to move instance label to job. This doesn't seem to be working. With config like this:

"""
- job_name: 'collectd_exporter'
honor_labels: true
target_groups:
- targets:
- 'localhost:9103'
relabel_configs:
- source_labels: [instance]
regex: (.*)
target_label: job
replacement: bzz-$1
"""

I get data that looks like this:

"""
collectd_cpu{cpu="0",instance="boxoob",job="bzz-",type="user"}
"""

I've played with trying to specify different set of source_labels - no matter which labels I specify, the labels always seem to be empty (that is, ".*" matches on ""). Changing regexp to (.+) results in relabeling not triggering at all. Finally, using the same config with metric_relabel_configs (as suggested on irc) results in the same behaviour.

At this point I think I'm tickling some weird bug, or I have some basic problem (like a typo) somewhere else.

I'd be grateful for any suggestions.

KT.

Brian Brazil

unread,
Oct 12, 2015, 4:45:28 PM10/12/15
to yac...@gmail.com, Prometheus Developers
On Mon, Oct 12, 2015 at 8:36 PM, <yac...@gmail.com> wrote:
Hello there,

I've decided to use collectd_exporter, to bridge in data that node_exporter doesn't yet know about. My collectd_exporter's /metrics seem to be populated correctly, showing data like this:

"""
collectd_cpu{cpu="0",instance="boxoob",type="idle"} 781937
collectd_cpu{cpu="0",instance="boxoob",type="interrupt"} 0
collectd_cpu{cpu="0",instance="boxoob",type="nice"} 1726
"""

In prometheus, I've tried to use relabel_configs to move instance label to job. This doesn't seem to be working. With config like this:

"""
  - job_name: 'collectd_exporter'
    honor_labels: true
    target_groups:
    - targets:
        - 'localhost:9103'
    relabel_configs:

As you want to affect the returned metrics rather than just the target, use metric_relabel_configs here.

Brian
 
      - source_labels: [instance]
        regex: (.*)
        target_label: job
        replacement: bzz-$1
"""

I get data that looks like this:

"""
collectd_cpu{cpu="0",instance="boxoob",job="bzz-",type="user"}
"""

I've played with trying to specify different set of source_labels - no matter which labels I specify, the labels always seem to be empty (that is, ".*" matches on ""). Changing regexp to (.+) results in relabeling not triggering at all. Finally, using the same config with metric_relabel_configs (as suggested on irc) results in the same behaviour.

At this point I think I'm tickling some weird bug, or I have some basic problem (like a typo) somewhere else.

I'd be grateful for any suggestions.

KT.

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Jakub Turski

unread,
Oct 12, 2015, 5:37:30 PM10/12/15
to Brian Brazil, Prometheus Developers
"""
  - job_name: 'collectd_exporter'
    honor_labels: true
    target_groups:
    - targets:
        - 'localhost:9103'
    relabel_configs:

As you want to affect the returned metrics rather than just the target, use metric_relabel_configs here.

The behaviour is the same with metric_relabel_configs - that is, relabeling happens, but the regexp matches on empty string.

KT.

Jakub Turski

unread,
Oct 12, 2015, 6:43:06 PM10/12/15
to Brian Brazil, Prometheus Developers
    relabel_configs:
As you want to affect the returned metrics rather than just the target, use metric_relabel_configs here.
The behaviour is the same with metric_relabel_configs - that is, relabeling happens, but the regexp matches on empty string.

Actually, scratch that. I've managed to slip in a typo in that piece of configuration when I changed it to metrics_relabel_configs ($1 got typoed to $k in the replacement). It works as expected now. Thanks for pointing things out :)

KT.
Reply all
Reply to author
Forward
0 new messages