fabric-samples/test-network/prometheus-grafana
Dave Kelsey f79190e88b
Update the grafana dashboard (#610)
Addresses some incorrect queries

Signed-off-by: D <d_kelsey@uk.ibm.com>

Co-authored-by: D <d_kelsey@uk.ibm.com>
2022-02-01 15:51:53 +00:00
..
grafana Update the grafana dashboard (#610) 2022-02-01 15:51:53 +00:00
grafana_db add prometheus/grafana performances sample into test-network directory (#576) 2022-01-20 09:37:37 +00:00
prometheus add prometheus/grafana performances sample into test-network directory (#576) 2022-01-20 09:37:37 +00:00
docker-compose.yaml add prometheus/grafana performances sample into test-network directory (#576) 2022-01-20 09:37:37 +00:00
README.md add prometheus/grafana performances sample into test-network directory (#576) 2022-01-20 09:37:37 +00:00

Description

This sample provides an environment to display and capture metrics from the test-network in real time. It consists of a docker-compose file that starts a prometheus and grafana server setup configured to collect and display metrics for the test network.

Requirements

This sample has been tested and is recomended to be used on linux in order to fully benefit from its capabilities, however it can be deployed and works on MacOS-intel machine as well (some modification to the cadvisor docker image and related queries are required to show docker containers metrics). You will need to have installed docker-compose with version 1.29 or above (note that this is higher than the v1.14 requirement requested for the test-network).

How to use

  1. Go to the test-network directory and run bring up the test-network ./network.sh up createChannel
  2. Bring up the Prometheus/Grafana network in the test-network/prometheus-grafana directory and run docker-compose up -d
  3. Log in: type “localhost:3000” on your web browser -> username=“admin”, password=“admin” -> set a new password
  4. Browse dashboard and analyse results
    • The default dashboard "HLF Performances Review" can be found and displayed by hovering over the dashboard menu and clicking on the browse button. picture alt Once opened the dashboard, to display the collected metrics and data, adjust the timeframe on the top right to focus on the latest timespan when the network was up.
  5. Deploy a chaincode (i.e. "./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go"), start using the test-network and use the grafana dashboard to analyse and assess your network performances. Extras: add new queries, modify dashboard & add relevant changes to main repo --> extract json and add it to "grafana/dashboards/hlf-performances.json". Metrics can also be displayed directly from Prometheus by going to "localhost:9090".

Docker Compose

Brings up

  • a prometheus sever (port 9090) -> pulls metrics from peers, orderer, system(node exporter) and containers(cadvisor)
  • grafana sever (port 3000) -> collects and display data from prometheus
  • node exporter (port 9100) -> exposes systems metrics
  • cadvisor (port 8080) -> exposes docker containers metrics

Prometheus "configuration file"

Prometheus.yml

Fabric metrics targets:

  • peer0.org1.example.com:9444
  • peer0.org2.example.com:9445
  • orderer.example.com:9443

System and docker metrics targets:

  • cadvisor:8080
  • node-exporter:9100

Check the state of the connections with targets on http://localhost:9090/targets.

Sources

Prometheus docs: https://prometheus.io/docs/introduction/overview/ Grafana docs: https://grafana.com/docs/