我使用端口映射4000:8080运行cadvisor,并且我必须使用prometheus将它与一个容器链接起来。
我的prometheus.yml是:
scrape_configs:
# Scrape Prometheus itself every 2 seconds.
- job_name: 'prometheus'
scrape_interval: 2s
target_groups:
- targets: ['localhost:9090', 'cadvisor:8080']此文件的路径为/home/test/prometheus.yml。为了使用prometheus运行容器,我这样做:
docker run -d -p 42047:9090 --name=prometheus -v /home/test/prometheus.yml:/etc/prometheus/prometheus.yml --link cadvisor:cadvisor prom/prometheus -config.file=/etc/prometheus/prometheus.yml -storage.local.path=/prometheus -storage.local.memory-chunks=10000 容器创建了,但它立即消失了。你能告诉我问题出在哪里吗?
来自docker events&的消息:
2016-11-21T11:43:04.922819454+01:00 container start 69d03c68525c5955cc40757dc973073403b13fdd41c7533f43b7238191088a25 (image=prom/prometheus, name=prometheus)
2016-11-21T11:43:05.152141981+01:00 container die 69d03c68525c5955cc40757dc973073403b13fdd41c7533f43b7238191088a25 (exitCode=1, image=prom/prometheus, name=prometheus)发布于 2017-08-03 11:28:21
配置格式已更改。在最新版本中,目标属于static_config。
scrape_configs:
# Scrape Prometheus itself every 2 seconds.
- job_name: 'prometheus'
scrape_interval: 2s
static_configs:
- targets: ['localhost:9090', 'cadvisor:8080']发布于 2018-02-10 11:51:44
是的,target_groups已重命名为static_configs。请将最新的Prometheus镜像与以下内容一起使用。
static_configs:
- targets: ['localhost:9090', 'cadvisor:8080']上面的方法对我很有效。
发布于 2016-12-07 21:06:32
我认为在最新版本的普罗米修斯中,scrape_configs已经弃用了target_groups。您可以尝试使用static_configs或file_sd_config
scrape_configs:
- job_name: node_exporter
static_configs:
- targets:
- "stg-elk-app-01:9100"
- "stg-app-02:9100"https://stackoverflow.com/questions/40717636
复制相似问题