Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upStatic config targets don't allow '/' characters #2697
Comments
This comment has been minimized.
This comment has been minimized.
|
The target itself indeed should only contain the host/IP and optionally the port. You can define the path to scrape via the |
juliusv
closed this
May 9, 2017
This comment has been minimized.
This comment has been minimized.
|
Hi @juliusv, thanks for looking into the issue. We have a number of applications to monitor and they share the same host name with different paths. Their URLs are like However, setting |
This comment has been minimized.
This comment has been minimized.
|
I see. One option would be to use separate scrape config sections, the other option would be to set the |
This comment has been minimized.
This comment has been minimized.
|
Hi, Yes, I guess it wasn't possible to add a number of scrape configs since scrape configs are defined at config root via its key. But modifying ---
scrape_configs:
- job_name: service1
static_configs:
- targets:
- host
relabel_configs:
- source_labels:
- __metrics_path__
action: replace
target_label: __metrics_path__
replacement: /path1/metrics
- job_name: service2
static_configs:
- targets:
- host
relabel_configs:
- source_labels:
- __metrics_path__
action: replace
target_label: __metrics_path__
replacement: /path2/metricsUpdate: I had to change ---
scrape_configs:
- job_name: service1
static_configs:
- targets:
- host
metrics_path: /path1/metrics
- job_name: service2
static_configs:
- targets:
- host
metrics_path: /path2/metrics |
This comment has been minimized.
This comment has been minimized.
zhoulouzi
commented
Jul 21, 2017
|
I got the same questions。some hosts was behind the proxy, but i canot access the endpoint directly 。 At first ,I do not want to have so many job__name, too difficult to manage, but finally I give each job with a set of the same label, so that it seem to be a group of jobs. Not a way to approach scrape_configs:
|
This comment has been minimized.
This comment has been minimized.
javamuc
commented
Feb 27, 2018
|
I'd suggest to reopen this issue and allow '/' in the target host name. It makes the configuration unreadable if I have to provide for each service behind a proxy with it's own job definition in the prometheus config. |
This comment has been minimized.
This comment has been minimized.
|
@javamuc You can set the metrics path for each target of a scrape config individually by setting the |
This comment has been minimized.
This comment has been minimized.
javamuc
commented
Feb 27, 2018
|
I see but I still can't seem to work it out. What I would like to have is this:
The workaround I see, and what you recommend if I understand your correctly, is in the comment above: "antuzun commented on May 10, 2017 ", but that does not solve that I have to have a job for every single service. |
This comment has been minimized.
This comment has been minimized.
jalberto
commented
Mar 16, 2018
|
prometheus allows multiple target with multiple ports & hosts, to not allow multiple paths is just inconsistent. Yes this can be done with relabeling, or with mutliple jobs, but is just cumbersome and confusing |
This comment has been minimized.
This comment has been minimized.
propertone
commented
Aug 15, 2018
|
I stumbled upon this issue as well. In case this is still relevant to anyone, you can work around this issue with a single job using the following relabel config:
|
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
Mar 22, 2019
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
hantuzun commentedMay 9, 2017
What did you do?
I tried to monitor a service behind my proxy. The service's url has a slash such as:
proxy/my_serviceWhat did you expect to see?
I expected Prometheus to start monitoring that url.
What did you see instead? Under which circumstances?
Prometheus has crashed while loading the config, complaining that the target url has a slash:
Environment
v1.6.1but the behavior is the same for master head at the moment.Comments
The control for forward slashes in static config targets are made here: config. CheckTargetAddress
I guess this check is for eliminating trailing slashes,
/metricsendpoints, and protocols such ashttp://in target urls. I'm curious if there're other reason to reject all service urls with slashes in them.We would certainly not like to proxy subdomains to the current urls for many reasons.