Reputation: 612
I have spring-boot project with dependencies for web and actuator which is running on port 7071
I am able to see prometheus and metric for my service triggers http://localhost:7071/prometheus http://localhost:7071/metrics
but somehow http://localhost:9090/targets appearing DOWN with error "INVALID" is not a valid start token
I have tried to checked similar issue but did not help - INVALID is not a valid start token
prometheus.yml
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'prometheus'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['localhost:9090','localhost:7071']
can you please help what is wrong with yaml configurations ?
Upvotes: 1
Views: 8378
Reputation: 1663
I found the solution after 1 week of searching on internet, that When you are inside a container, you cannot access the localhost directly. You will need to add docker.for.win.localhost to your prometheus.yml file. See below:
- job_name: 'spring-actuator'
metrics_path: '/actuator/prometheus'
scrape_interval: 5s
static_configs:
- targets: ['docker.for.win.localhost:8080']
Upvotes: 2