【发布时间】:2019-06-21 04:31:09
【问题描述】:
我正在尝试使用我的 Hyperledger Fabric v1.4 网络配置 Prometheus 和 Grafana,以分析对等点和链码 mertics。在遵循此documentation 之后,我已将对等容器的端口9443 映射到我的主机端口9443。我还将 provider 条目更改为 prometheus 下的 metrics 部分 core.yml 的对等。我在docker-compose.yml中配置了prometheus和grafana,方式如下。
prometheus:
image: prom/prometheus:v2.6.1
container_name: prometheus
volumes:
- ./prometheus/:/etc/prometheus/
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
- '--storage.tsdb.retention=200h'
- '--web.enable-lifecycle'
restart: unless-stopped
ports:
- 9090:9090
networks:
- basic
labels:
org.label-schema.group: "monitoring"
grafana:
image: grafana/grafana:5.4.3
container_name: grafana
volumes:
- grafana_data:/var/lib/grafana
- ./grafana/datasources:/etc/grafana/datasources
- ./grafana/dashboards:/etc/grafana/dashboards
- ./grafana/setup.sh:/setup.sh
entrypoint: /setup.sh
environment:
- GF_SECURITY_ADMIN_USER={ADMIN_USER}
- GF_SECURITY_ADMIN_PASSWORD={ADMIN_PASS}
- GF_USERS_ALLOW_SIGN_UP=false
restart: unless-stopped
ports:
- 3000:3000
networks:
- basic
labels:
org.label-schema.group: "monitoring"
当我在远程 centos 机器上curl 0.0.0.0:9443/metrics 时,我得到了所有指标列表。但是,当我使用上述配置运行 Prometheus 时,它会抛出错误 Get http://localhost:9443/metrics: dial tcp 127.0.0.1:9443: connect: connection refused。这就是我的prometheus.yml 的样子。
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: 'prometheus'
scrape_interval: 10s
static_configs:
- targets: ['localhost:9090']
- job_name: 'peer_metrics'
scrape_interval: 10s
static_configs:
- targets: ['localhost:9443']
甚至,当我在浏览器中访问端点 http://localhost:9443/metrics 时,我得到了所有指标。我在这里做错了什么。为什么 Prometheus 指标会显示在其界面上而不是同行的界面上?
【问题讨论】:
标签: docker hyperledger-fabric prometheus