Docker - Prometheus容器立即死亡

Seg*_*ult 4 containers docker prometheus cadvisor

我有一个运行端口映射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']
Run Code Online (Sandbox Code Playgroud)

此文件具有路径/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 
Run Code Online (Sandbox Code Playgroud)

容器已创建,但会立即死亡.你能告诉我问题出在哪里吗?

消息形式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)
Run Code Online (Sandbox Code Playgroud)

小智 7

配置格式已更改.目标在最新版本的static_config下.

scrape_configs:
# Scrape Prometheus itself every 2 seconds.
  - job_name: 'prometheus'
  scrape_interval: 2s
  static_configs:
      - targets: ['localhost:9090', 'cadvisor:8080']
Run Code Online (Sandbox Code Playgroud)

Prometheus文档以获得进一步的帮助


Vik*_*ote 7

是的,target_groups重命名为static_configs. 请使用带有以下内容的最新 Prometheus 映像。

static_configs:
  - targets: ['localhost:9090', 'cadvisor:8080']
Run Code Online (Sandbox Code Playgroud)

以上对我有用。


bri*_*zil 1

缩进不正确,请尝试:

scrape_configs:
  # Scrape Prometheus itself every 2 seconds.
  - job_name: 'prometheus'
    scrape_interval: 2s
    target_groups:
    - targets: ['localhost:9090', 'cadvisor:8080']
Run Code Online (Sandbox Code Playgroud)

  • 您使用的是哪个版本的普罗米修斯?不久前,“target_groups”被重命名为“static_configs”。如果没有任何错误输出,调试起来非常困难。 (2认同)