xuchenhao001 / hyperlook

Hyperledger Fabric monitoring project
Apache License 2.0
36 stars 29 forks source link
golang hyperledger-fabric kubernetes prometheus

Hyperlook

Hyperledger Fabric monitoring project based on kubernetes.

This project is meant to monitor your Fabric network's status. The monitoring targets have 2 part:

There are 5 parts of this project:

Prerequisite

Build

Build hyperlook binary and docker image:

cd hyperlook/
CGO_ENABLED=0 go build
docker build -t hyperlook:latest .

Build netctl binary and docker image:

cd hyperlook/fabric-sample-network/netctl/
./build.sh

Deploy monitoring system

1. Start Kubernetes

I perfer to install Kubernetes through kubeadm, See this official doc.

2. Deploy prometheus

I perfer to install prometheus through prometheus-operator, see this doc.

3. Deploy Elasticsearch

Hyperlook can analysis logs based on elasticsearch, so we must deploy it first. See this doc.

After deploy, the elasticsearch needs some time to work well (Maybe more than 20 mins, which is depends on your vm's performance).

4. Start up Hyperledger Fabric network

See here.

5. Start up hyperlook

cd hyperlook/
kubectl create -f kubernetes/manifests/

6. Setup grafana dashboard

Open your browser and go to http://<your-host-ip>:30902, login with username admin and password admin. Then import my Fabric dashboard in hyperlook/grafana-dashboard/Fabric.json

7. Setup Alert rules

cd hyperlook/alert/
kubectl create -f prometheus-config.yaml
# make changes effective
curl -X POST <your-host-ip>:30900/-/reload

8. Operate your fabric network

docker exec -ti netctl sh
netctl createchannel 
netctl joinchannel 
netctl installCC 
netctl instantiateCC 
netctl invokeCC 
netctl queryCC 
netctl upgradeCC

# OR

docker exec -ti cli bash
scripts/script.sh

After operation, you will see the monitoring data curve on your grafana dashboard.