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 upTarget "prometheus" in docker image is always DOWN #2260
Comments
This comment has been minimized.
This comment has been minimized.
|
Posting your config would be helpful, but I'm guessing the target you actually want is |
This comment has been minimized.
This comment has been minimized.
|
I'm just using the default config in docker, I copied it from http://localhost:9090/config # my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Attach these labels to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager).
external_labels:
monitor: 'codelab-monitor'
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first.rules"
# - "second.rules"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
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'] |
This comment has been minimized.
This comment has been minimized.
|
I've just tested running |
This comment has been minimized.
This comment has been minimized.
|
@sdurrheimer Can you help to take a look at the endpoint of target "prometheus"? |
This comment has been minimized.
This comment has been minimized.
|
The prometheus endpoint is |
This comment has been minimized.
This comment has been minimized.
|
This is my target, notice the link at the bottom. |
This comment has been minimized.
This comment has been minimized.
|
The link looks okay to me given that the default hostname of a docker container is the ID of the container. What is strange, is that prometheus can't scrape itself on your side. |
This comment has been minimized.
This comment has been minimized.
|
@sdurrheimer Yes, it is strange. Don't know why. |
This comment has been minimized.
This comment has been minimized.
|
I tested on Ubuntu, and it's ok. |
This comment has been minimized.
This comment has been minimized.
|
Close this as I cannot see the cause. |
goofansu
closed this
Dec 8, 2016
This comment has been minimized.
This comment has been minimized.
|
@sdurrheimer Did you try on macOS? I tested on three macOS and all show "DOWN". Two are in the same network, one in another network. |
goofansu
reopened this
Dec 9, 2016
This comment has been minimized.
This comment has been minimized.
|
What are you using as a host for the container @goofansu ? |
This comment has been minimized.
This comment has been minimized.
|
@brancz I'm using Docker for Mac app.
|
This comment has been minimized.
This comment has been minimized.
|
Interesting. I was able to reproduce it with the Docker for Mac client. It can't resolve I exec'd into the container:
Replaced the target from
And made Prometheus reload the config:
... and it worked. So while we can improve the default config here, there is something else odd, but I have the feeling it has to do with the Docker for Mac client. |
This comment has been minimized.
This comment has been minimized.
|
@brancz Ok, I'll use |
goofansu
closed this
Dec 9, 2016
This comment has been minimized.
This comment has been minimized.
|
It looks like more a Docker for Mac thing, I know they do some hacky/magic things when resolving names. |
This comment has been minimized.
This comment has been minimized.
simonvanderveldt
commented
Dec 21, 2016
|
@sdurrheimer do you know why prometheus doesn't actually use Also, does prometheus do some custom stuff with determining the hostname? Within the container we have this in
From within this container |
This comment has been minimized.
This comment has been minimized.
Robpol86
commented
Dec 27, 2016
|
I ran into this too (using 127.0.0.1 fixed it for me too). I'm testing out prometheus on a Fedora Server 25 VM with no additional/3rdparty repos (no official Docker YUM repos):
|
This comment has been minimized.
This comment has been minimized.
Robpol86
commented
Dec 27, 2016
•
|
So I did some digging and may have found the culprit (maybe it's a bug?). 127.0.0.1 did indeed work however "localhost" still didn't. Neither did "prometheus", my container_name. Nor did "cadviser", another container. While refreshing http://localhost:9090/targets I noticed the error message changed from "context deadline exceeded" to something with "hangup 198.105.244.117" (sorry didn't copy the error message). Anyway it was very weird seeing a public IP in the error when I was pointing to localhost. It turns out that IP is a Suddenlink DNS server of sorts (I'm at my parents house for the holidays). Once I removed that DNS and stuck with 8.8.8.8 on my Mac (I'm running Fedora Server 25 via virtualbox) and rebooted my VM all of a sudden "localhost" and "cadviser" addresses in prometheus.yml started working. Everything is "UP" in http://localhost:9090/targets ! Basically this is probably a weird DNS issue with either Docker, the Docker that ships with Fedora, Fedora, or Prometheus. Not really sure though. Edit: Now that I think about it it may be Suddenlink resolving localhost and everything else to inject their advertising or data cap limit messages. Probably not a bug, just an unfortunate side effect for this annoying practice. |
This comment has been minimized.
This comment has been minimized.
fer-marino
commented
Feb 13, 2017
|
I had the same issue. At the end it was an incorrect dns configuration on the host machine. Nothing to do with prometheus or docker. |
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
Mar 24, 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. |

goofansu commentedDec 7, 2016
•
edited
What did you do?
docker run -p 9090:9090 prom/prometheus:latestWhat did you expect to see?
The state of target "prometheus" should be "UP".
What did you see instead? Under which circumstances?
The state of target "prometheus" is "DOWN".
Environment
System information:
Darwin 15.6.0 x86_64
Prometheus version:
Logs:
FYI, the endpoint is like http://d101b017c30f:9090/metrics, the
d101b017c30fis the container ID.