diff --git a/3.x/zh_CN/docs/develop/light_monitor.md b/3.x/zh_CN/docs/develop/light_monitor.md index b30db621f..c03d436d5 100644 --- a/3.x/zh_CN/docs/develop/light_monitor.md +++ b/3.x/zh_CN/docs/develop/light_monitor.md @@ -124,3 +124,87 @@ alarm() { curl -H "Content-Type: application/json" -X POST --data "{'title':'alarm','alert_ip':'${alert_ip}','alert_info':'${alert_msg}'}" http://127.0.0.1:1111/alarm/request } ``` + + + +## **节点监控** + +`FISCO-BCOS 3.0`区块链监控工具,可以监控区块链区块高度等一些指标,在图形化的界面显示. + +涉及的组件包括grafana(用于展示指标),prometheus(用于采集指标信息),mtail(用于分析区块链日志信息获取指标). + +### 安装搭建 + +​ 监控工具可以在搭建区块链的时候选择是否随着搭建一起部署,相关参数如下(其他参数可以参考区块链网络搭建教程): + + ### **`m`节点监控选项[**Optional**]** + +可选参数,当区块链节点启用节点监控时,可通过`-m`选项来部署带监控的节点,若不选择该选项则只部署不带监控的节点。 + +部署开启监控的Air版本区块链示例如下: + +```shell +[root@172 air]# bash build_chain.sh -p 30300,20200 -l 127.0.0.1:4 -o nodes -e ./fisco-bcos -t ./mtail -m +[INFO] Use binary ./fisco-bcos +[INFO] Use binary ./mtail +[INFO] Generate ca cert successfully! +Processing IP:127.0.0.1 Total:4 +[INFO] Generate nodes/127.0.0.1/sdk cert successful! +[INFO] Generate nodes/127.0.0.1/node0/conf cert successful! +[INFO] Generate nodes/127.0.0.1/node1/conf cert successful! +[INFO] Generate nodes/127.0.0.1/node2/conf cert successful! +[INFO] Generate nodes/127.0.0.1/node3/conf cert successful! +[INFO] Begin generate uuid +[INFO] Generate uuid success: 1357cd37-6991-44c0-b14a-5ea81355c12c +[INFO] Begin generate uuid +[INFO] Generate uuid success: c68ebc3f-2258-4e34-93c9-ba5ab6d2f503 +[INFO] Begin generate uuid +[INFO] Generate uuid success: 5311259c-02a5-4556-9726-daa1ee8fbefc +[INFO] Begin generate uuid +[INFO] Generate uuid success: d4e5701b-bbce-4dcc-a94f-21160425cdb9 +============================================================== +[INFO] fisco-bcos Path : ./fisco-bcos +[INFO] Auth Mode : false +[INFO] Start Port : 30300 20200 +[INFO] Server IP : 127.0.0.1:4 +[INFO] SM Model : false +[INFO] output dir : nodes +[INFO] All completed. Files in nodes +``` +提示All completed. Files in nodes,说明生成完区块链节点文件. + +### 使用流程 + +#### 第一步. 启动FISCO BCOS链 + +- 启动所有节点 + +```shell +bash nodes/127.0.0.1/start_all.sh +``` +启动成功会输出如下信息。否则请使用`netstat -an |grep tcp`检查机器`30300~30303, 20200~20203`端口是否被占用。 + +```shell +try to start node0 +try to start node1 +try to start node2 +try to start node3 + node3 start successfully pid=36430 + node2 start successfully pid=36427 + node1 start successfully pid=36433 + node0 start successfully pid=36428 +``` + +#### 第二步. 启动监控脚本 + +启动节点监控 + +```shell +sh nodes/monitor/start_monitor.sh +``` + +#### 第三步.根据提示登录grafana,查看指标 + +url启动脚本会打印对应的地址,默认用户名密码为admin/admin登录页面后导入Dashboard([github源码](https://github.com/FISCO-BCOS/FISCO-BCOS/blob/master/tools/template/Dashboard.json)) + +,配置prometheus源(http://ip:9090/),就可以查看各个指标实时展示。