docker工人 – 普罗米修斯集装箱马上死亡
我有一个使用端口映射4000:8080的pipe理程序,我必须将它与一个带有prometheus的容器链接起来。
我的prometheus.yml是:
scrape_configs: # Scrape Prometheus itself every 2 seconds. - job_name: 'prometheus' scrape_interval: 2s target_groups: - targets: ['localhost:9090', 'cadvisor:8080']
这个文件有path/home/test/prometheus.yml。 用普罗米修斯来运行容器,我这样做:
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
容器被创build,但它立即死亡。 你能告诉我问题在哪里吗?
消息形成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)
我认为target_groups
在最新版本的prometheus中已经被target_groups
弃用了。 你可以试试static_configs或者file_sd_config
scrape_config
static_config
file_sd_config
scrape_configs: - job_name: node_exporter static_configs: - targets: - "stg-elk-app-01:9100" - "stg-app-02:9100"
缩进不正确,请尝试:
scrape_configs: # Scrape Prometheus itself every 2 seconds. - job_name: 'prometheus' scrape_interval: 2s target_groups: - targets: ['localhost:9090', 'cadvisor:8080']
configuration格式已更改。 目标在最新版本的static_config下。
scrape_configs: # Scrape Prometheus itself every 2 seconds. - job_name: 'prometheus' scrape_interval: 2s static_configs: - targets: ['localhost:9090', 'cadvisor:8080']
普罗米修斯文件的进一步帮助
容器的名字是prometheus
。
通常,当一个容器在启动后立即存在时,我build议在-log.level=debug
之后添加-log.level=debug
。
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 -log.level=debug -storage.local.path=/prometheus -storage.local.memory-chunks=10000
接下来,查看容器的日志:
docker logs prometheus
任何与configuration有关的问题将在那里。
正如你在之前的评论中所说:
from logs: time="2016-11-21T11:21:40Z" level=error msg="Error loading config: couldn't load configuration (-config.file=/etc/prometheus/prometheus.yml): unknown fields in scrape_config: target_groups" source="main.go:149"
这显然意味着“target_groups”字段导致了问题。 这是因为新版本的Prometheus(v1.5以上版本)已经放弃了“target_groups”字段的使用,只是提供了目标。 即使在6个月前我也遇到过这个问题。 请用新版本尝试。 docker pull prom/prometheus
可能会让你的老。
希望这可以帮助…!!!
- 如何查看PHP的日志信息与PHPdocker容器?
- 依赖容器以及与IBM DevOps Services构buildpipe道的链接
- Docker容器发布的端口不可访问?
- 生产中每个主机应该存在多less个容器? 应该如何拆分服务?
- 启动容器之前,将主机系统中的文件复制到Docker镜像
- 容器到容器通信 – Docker for Windows
- 更新现有的Docker镜像,并且一旦Dockerfile发生变化,全部包含镜像
- 使用错误的docker图像构build容器的gitlab亚军
- 无法在registry.ng.bluemix.net上使用IBM Containersregistry进行身份validation