【问题标题】:How to monitor Hyperledger Fabric network with grafana?如何使用 grafana 监控 Hyperledger Fabric 网络?
【发布时间】:2020-10-20 14:26:55
【问题描述】:

我正在尝试使用 Prometheus 和 grafana 监控 Fabric 网络,但我找不到任何示例或文档。所以,我正在启动 fabcar 示例(v1.4)。

在那之后,我按照这个例子https://www.youtube.com/watch?v=4WWW2ZLEg74 这是关于Prometheus和Grafana的设置。最后,我添加了这个仪表板https://grafana.com/grafana/dashboards/10716,它是关于 Hyperledger Fabric Monitoring for 1.4 的。

但是,我没有关于我的频道的指标。每个图表都是空的。我不确定我的步骤是否正确。有人知道如何使用 Grafana for Fabric 的类似示例或文档吗?

【问题讨论】:

  • 您是否修改了 docker-compose 文件以公开指标?我可能知道您的问题的答案,但我需要了解有关您的配置的更多详细信息。
  • @XhensB 感谢您的回复。不,我没有修改 docker compose 文件来公开指标。我没有找到任何示例如何执行此操作。你能举个例子吗?
  • 你可以看看我的文章:medium.com/@pouyashojaei85/…

标签: hyperledger-fabric hyperledger grafana


【解决方案1】:

编辑docker-compose-test-net.yaml并将这些行添加到orderer.example.com的环境变量中:

  - ORDERER_OPERATIONS_LISTENADDRESS=orderer.example.com:your_port
  - ORDERER_METRICS_PROVIDER=prometheus

在每个peer 上添加这些环境变量:

  - CORE_OPERATIONS_LISTENADDRESS=peer0.org1.example.com:your_port
  - CORE_METRICS_PROVIDER=prometheus

但记得要分别更改 orderer 和 peers address:port。

orderer配置示例:

orderer.example.com:
container_name: orderer.example.com
image: hyperledger/fabric-orderer:$IMAGE_TAG
environment:
  - FABRIC_LOGGING_SPEC=DEBUG
  - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
  - ORDERER_GENERAL_LISTENPORT=7050
  - ORDERER_GENERAL_GENESISMETHOD=file
  - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
  - ORDERER_GENERAL_LOCALMSPID=OrdererMSP
  - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
  # enabled TLS
  - ORDERER_GENERAL_TLS_ENABLED=true
  - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
  - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
  - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
  - ORDERER_KAFKA_TOPIC_REPLICATIONFACTOR=1
  - ORDERER_KAFKA_VERBOSE=true
  - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt
  - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key
  - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
  - ORDERER_OPERATIONS_LISTENADDRESS=orderer.example.com:9443
  - ORDERER_METRICS_PROVIDER=prometheus
  - TZ=Europe/Berlin
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
command: orderer
volumes:
    - ../system-genesis-block/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
    - ../organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp
    - ../organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls
    - orderer.example.com:/var/hyperledger/production/orderer
ports:
  - 7050:7050
networks:
  - test

【讨论】:

  • 当您说 your_port 时,您是指来自核心的端口。来自操作部分的 yaml 文件?例如,从这个listenAddress: 127.0.0.1:9443 我将添加这个- CORE_OPERATIONS_LISTENADDRESS=peer0.org1.example.com:9443
  • 和我的 prometheus.yaml 文件:global: scrape_interval: 15s evaluation_interval: 15s scrape_configs: - job_name: ‘prometheus’ scrape_interval: 10s static_configs: - targets: [‘localhost:9090’] - job_name: ‘hyperledger_metrics’ scrape_interval: 10s static_configs: - targets: [‘peer0.org1.example.com:9443’, ‘peer0.org2.example.com:9443’, ‘peer1.org2.example.com:9443’, ‘peer1.org1.example.com:9443’, ‘orderer.example.com:9443’]
  • 关于第一条评论:正是。但不要忘记,对于 orderer 容器,您必须使用 ORDERER_OPERATIONS_LISTENADDRESS 和 ORDERER_METRICS_PROVIDER,而对于 peers,则使用以 CORE_ 开头的那些。关于第二条评论(prometheus 配置文件):看起来很不错。试试看,让我知道:)
  • @XhensB 谢谢你的建议。我将您的指令用于订购者和同行,但是当我在 [link] localhost:9090/targets 打开 prometheus 时,“prometheus”和“hyperledger_metrics”的状态已关闭。每个端点的错误选项卡是“主机后的端口无效”。
  • 您还需要将操作端口添加到 YAML 文件的 [ports] 部分,即- 9443:9443
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多