Reputation: 14993
I'm using the prometheus file based service discovery. However when pulling in my list of servers I realized that my service's metrics endpoint is /prometheus
no /metrics
I've seen that I can use relabelling to fix this.
- job_name: 'servers-dev'
file_sd_configs:
- files: ['/prometheus/topology.json']
relabel_configs:
- source_labels: [?????]
action: replace
target_label: __metrics_path__ #I want this to be /prometheus
regex: (.+)
How can I add in label using relabeling?
Upvotes: 2
Views: 4980
Reputation: 34172
There's no need to use relabelling here, you can just add
metrics_path: /prometheus
to the scrape config.
To do this with relabelling you'd do:
- target_label: __metrics_path__
replacement: /prometheus
as the defaults are such that you don't need to worry about the other config options.
Upvotes: 2