hyperledger-fabrichyperledgergrafana

How to monitor Hyperledger Fabric network with grafana?


I am trying to monitor Fabric network with Prometheus and grafana but i cannot find any example or documentation. So, i am starting the fabcar example(v1.4).

After that, i followed this example 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 which is about Hyperledger Fabric Monitoring for 1.4.

However, i have no metrics about my channel. Every graph is empty. I am not sure if my steps are right. Does anybody know any similar example or documentation how to use Grafana for Fabric?


Solution

  • Edit the docker-compose-test-net.yaml and add these lines on environment variables of orderer.example.com:

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

    On each peer add these environment variables:

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

    But remember to change the orderer and the peers address:port respectively.

    Example of the orderer configuration:

    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