更改文件配置时如何修复502 Bad Gateway?

时间:2019-04-02 10:27:18

标签: prometheus

我在AWS上部署了Docker Swarm监控 => https://github.com/stefanprodan/swarmprom

当我尝试访问普罗米修斯时,它正常工作。 但是,当我想在prometheus的文件配置中更改scrape_timeout时,出现了此问题“ 502 Bad Gateway”

================================================ ======================

我试图将此路径“ / etc / prometheus /”更改为本地路径,该路径是我的配置文件“ prometheus.yml”

'-config.file = / etc / prometheus / prometheus.yml'

'-config.file =。/ prometheus / conf / prometheus.yml'

但是尝试访问时出现此错误:502错误的网关

我也尝试过像Caddy一样,配置文件并将其添加到prometheus配置中,但是我遇到了同样的问题。

....
configs:
  caddy_config:
    file: ./caddy/Caddyfile
   prometheus_config:
    file: ./prometheus/conf/prometheus.yml
.....
  prometheus:
    image: stefanprodan/swarmprom-prometheus:v2.2.0-rc.0
    networks:
      - net
    volumes:
      - prometheus:/prometheus
    configs:
      - source: prometheus_config
        target: /etc/prometheus/prometheus.yml

Prometheus配置文件:

global:
  scrape_interval: 15s
  scrape_timeout: 5s
  evaluation_interval: 15s
  external_labels:
    monitor: promswarm
alerting:
  alertmanagers:
  - static_configs:
    - targets:
      - alertmanager:9093
    scheme: http
    timeout: 10s
rule_files:
- /etc/prometheus/swarm_node.rules.yml
- /etc/prometheus/swarm_task.rules.yml
scrape_configs:
- job_name: prometheus
  scrape_interval: 15s
  scrape_timeout: 5s
  metrics_path: /metrics
  scheme: http
  static_configs:
  - targets:
    - localhost:9090
- job_name: dockerd-exporter
  scrape_interval: 15s
  scrape_timeout: 10s
  metrics_path: /metrics
  scheme: http
  dns_sd_configs:
  - names:
    - tasks.dockerd-exporter
    refresh_interval: 30s
    type: A
    port: 9323
- job_name: cadvisor
  scrape_interval: 15s
  scrape_timeout: 10s
  metrics_path: /metrics
  scheme: http
  dns_sd_configs:
  - names:
    - tasks.cadvisor
    refresh_interval: 30s
    type: A
    port: 8080
- job_name: node-exporter
  scrape_interval: 15s
  scrape_timeout: 10s
  metrics_path: /metrics
  scheme: http
  dns_sd_configs:
  - names:
    - tasks.node-exporter
    refresh_interval: 30s
    type: A
    port: 9100

0 个答案:

没有答案