This question is better suited to the prometheus-users mailing list, I'm
moving it there.
>From the config I take it you are trying to achieve this in the graphite
exporter?
What you are trying will not be possible using the (faster) glob match
type. You are on the right track with using match_type: regex, only your
regex is not quite right.
Try
mappings:
- match: 'panos\.(.*):(.*)'
match_type: regex
name: test_graphite_metric
labels:
device: $1
job: test_graphite
entity: $2
With this it works for me:
[I] ~/s/g/p/graphite_exporter (master|✔) $ echo "panos.device1:entity1 1234
"(date +%s) | nc localhost 9109
[I] ~/s/g/p/graphite_exporter (master|✔) $ curl -sSf
http://127.0.0.1:9108/metrics | fgrep test
# HELP test_graphite_metric Graphite metric test_graphite_metric
# TYPE test_graphite_metric gauge
test_graphite_metric{device="device1",entity="entity1",job="test_graphite"}
1234
Hope that helps!
MR
On Tue, Apr 7, 2020 at 11:05 AM Panem78 <[email protected]> wrote:
> Hello everyone,
> I am looking to match a metric path such as
> "*panos.device1:entity1*"
> in order to be translated into prometheus labels such as :
>
> test_graphite_metric{device="device1",entity="entity1",instance="localhost:9108",job="test_graphite",tsdb="prometheus"}
>
> Can i achieve this somehow with a regex or '*'s act as wildcards for ONLY
> dot-separated metrics ?
>
> Some of my non successful attempts include the following mapping
> (mentioning it here to be somewhat more clear what i want to achieve)
>
> - match: panos.*\\:*
> match_type: regex
> name: test_graphite_metric
> labels:
> device: $1
> job: test_graphite
> entity: $2
>
> Thanks in advance!
>
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/prometheus-developers/d99475a4-f3df-40d0-84e1-38478c74c2d9%40googlegroups.com
> <https://groups.google.com/d/msgid/prometheus-developers/d99475a4-f3df-40d0-84e1-38478c74c2d9%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/prometheus-developers/CAMV%3D_gYgHuV%2BObEbDvQhW-eduny-NypVexyB4h8sbKs%3Dz23tUw%40mail.gmail.com.