prometheus 监控 Hyperledger Fabric 网络

本例中使用的 fabric 版本为 2.4.1

修改 orderer , peer 节点 docker-compose 文件

orderer 节点:

复制代码
environment:
   - ORDERER_METRICS_PROVIDER=prometheus
   - ORDERER_OPERATIONS_LISTENADDRESS=0.0.0.0:8443
ports:
   - 8443:8443

peer 节点:

复制代码
environment:
   - CORE_METRICS_PROVIDER=prometheus
   - CORE_OPERATIONS_LISTENADDRESS=0.0.0.0:8443
ports:
   - 8443:8443

编写 prometheus.yml

复制代码
global:
  scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
#alerting:
#  alertmanagers:
#    - static_configs:
#        - targets: ['10.10.170.161:9093']
          # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
#rule_files:
#  - "node_down.yml"
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'hyperledger-fabric'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ['orderer0.example.com:8443' , 'orderer1.example.com:8444' , 'orderer2.example.com:8445' , 'peer0.org1.example.com:9443' , 'peer1.org1.example.com:9444' , 'peer0.org2.example.com:9443' , 'peer1.org2.example.com:9444']

编写 docker-compose-prometheus.yaml

复制代码
version: '2.0'

services:

  prometheus:
    image: prom/prometheus:latest
    restart: always
    container_name: prometheus
    ports:
      - 9999:9090
    extra_hosts:
      - "orderer0.example.com:192.168.0.105"
      - "orderer1.example.com:192.168.0.105"
      - "orderer2.example.com:192.168.0.105"
      - "peer0.org1.example.com:192.168.0.109"
      - "peer1.org1.example.com:192.168.0.109"
      - "peer0.org2.example.com:192.168.0.110"
      - "peer1.org2.example.com:192.168.0.110"
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml

  grafana:
    image: grafana/grafana
    restart: always
    container_name: grafana
    ports:
      - 3000:3000
    depends_on:
      - prometheus

启动 prometheus :

复制代码
docker-compose -f docker-compose-prometheus.yaml up -d

浏览器中访问:

http://192.168.0.105:9999/targets

浏览器中访问: http://192.168.0.105:3000/ 打开 Grafana 界面

添加 prometheus 数据源:

配置 prometheus URL:

访问 https://grafana.com/grafana/dashboards/ 搜索需要监控组件的 dashboards 文件

Hyperledger Fabric 监控目前只支持 1.4 版本。2.x 版本的应该之后会出。

复制这个 dashboard id 添加 fabric dashboard:

效果如下:

grafanaymldocker composehyperledger fabricfabricprometheusdashboardsyaml

© 著作权归作者所有

举报

相关推荐
czhc11400756639 分钟前
Linux 76 rsync
linux·运维·python
你不知道我是谁?1 小时前
负载均衡--四层、七层负载均衡的区别
运维·服务器·负载均衡
dyj0951 小时前
【Rancher Server + Kubernets】- Nginx-ingress日志持久化至宿主机
运维·nginx·rancher
码出钞能力3 小时前
linux内核模块的查看
linux·运维·服务器
星辰云-3 小时前
# Linux Centos系统硬盘分区扩容
linux·运维·centos·磁盘扩容
Hellc0073 小时前
Nginx 高级 CC 与 DDoS 防御策略指南
运维·nginx·ddos
feilieren4 小时前
Docker 安装 Elasticsearch 9
运维·elasticsearch·docker·es
小皮侠5 小时前
nginx的使用
java·运维·服务器·前端·git·nginx·github
Maki Winster5 小时前
在 Ubuntu 下配置 oh-my-posh —— 普通用户 + root 各自使用独立主题(共享可执行)
linux·运维·ubuntu
翻滚吧键盘6 小时前
debian及衍生发行版apt包管理常见操作
运维·debian