relabel don't find label

43 views
Skip to first unread message

Kordován Szabolcs

unread,
Mar 8, 2023, 2:57:08 PM3/8/23
to Prometheus Users
Hi All,

I would like to modify a label but it seems that prometheus doesn't find the label. I have checked the source of the relabel, I found nothing.

The metric:
zxAnGponRmAniRxOptLevel{ifDescr="gponxxxxx", ifIndex="285278721", instance="xxx.xxx.xxx.xxx:yyyyy", job="query", zxAnGponOnuMgmtRegistrationInfo="1,ZTEGXXXXXXXX", zxAnGponRmAniIndex="1", zxAnPonOnuIndex="2"}
3661

The config:
    relabel_configs:
      - source_labels: [zxangpononumgmtregistrationinfo]
        regex: .*,(.*)
        replacement: "$1"
        target_label: "SN"

Do you have any idea?

Brian Candler

unread,
Mar 8, 2023, 4:03:46 PM3/8/23
to Prometheus Users
You need to use metric_relabel_configs, not relabel_configs.

* relabel_configs is run for the target relabelling phase, before scraping.  It can be used to modify the address and port being scraped.
* metric_relabel_configs is run after scraping.  It can be used to modify or drop the metrics returned by the scrape.

Also, I believe the label names are case-sensitive.

Kordován Szabolcs

unread,
Mar 9, 2023, 12:35:13 PM3/9/23
to Brian Candler, Prometheus Users
Hi Brian,

Thanks for your help. Now it works well.

BR,.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/ea5bcf7b-9feb-48f4-beb8-55a4dff851a3n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages