如何使用 grafana 监控 Hyperledger Fabric 网络?

How to monitor Hyperledger Fabric network with grafana?

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

之后,我遵循了这个关于 1.4 的 Hyperledger Fabric Monitoring 的示例 https://www.youtube.com/watch?v=4WWW2ZLEg74 which is about the set set up of Prometheus and Grafana. Finally, i added this dashboard https://grafana.com/grafana/dashboards/10716

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

编辑 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

但记得分别更改订购者和同行address:port

订购者配置示例:

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