Codementor Events

How to build Ethereum Dashboard and to monitor your Ethereum Network Status

Published Dec 25, 2018

Go to the profile of 胡家維 Hu Kenneth

胡家維 Hu KennethBlockedUnblockFollowFollowing

Dec 12

DashBoard

Architecture

  • eth-netstats : This is a visual interface for tracking ethereum network status. It uses WebSockets to receive stats from running nodes and output them through an angular interface.
  • eth-net-intelligence-api : This is the backend service which runs along with ethereum and tracks the network status, fetches information through JSON-RPC and connects through WebSockets to eth-netstats to feed information. For full install instructions please read the wiki.
  • Ethereum node (it can be private node or public node)

Prerequisite

Here are the steps:

  1. execute ethereum private/public node
  2. Download and Install Tools
  3. Configure the Node Monitoring App
  4. Start the Node App
  5. Start the Frontend

Folder structure

1. Execute ethereum private/public node

If you are unfamiliar with how to do this, please refer to my previous article for a step-by-step guide. To execute Ethereum private node the following command:

geth --networkid 4224 --datadir "E:\privateChain\GethPrivateChain" --nodiscover --rpc --rpcport "8545" --port "30303" --rpccorsdomain "*" --nat "any" --rpcapi eth,web3,personal,net --unlock 0 --password password.sec

2. Download and Install Tools

To clone and install eth-netsates run the following command:

C:\> git clone [https://github.com/cubedro/eth-netstats](https://github.com/cubedro/eth-netstats) 
C:\> cd eth-netstats 
C:\eth-netstats> npm install 
C:\eth-netstats> npm install -g grunt-cli
C:\eth-netstats> grunt

To clone and install eth-net-intelligence-api run the following command:

C:\> git clone https://github.com/cubedro/eth-net-intelligence-api 
C:\> cd eth-net-intelligence-api 
C:\eth-net-intelligence-api> npm install 
C:\eth-net-intelligence-api> npm install -g pm2

3. Configure the Node Monitoring App

We will need to modify the app.json file located in the eth-net-intelligence-api directory:

There are few configurations that need to be changed in this file.

  • "name": The name that will appear for your node app in the pm2 process manager (see next section for more details on pm2)
  • "RPC_HOST": The IP address for the machine hosting your running gethinstance
  • "RPC_PORT": The RPC port that your geth instance is running on
  • "LISTENING_PORT": The network listening port for your geth instance
  • "INSTANCE_NAME": The name that will appear on the dashboard in your browser for this particular node
  • "WS_SERVER": The server address for the frontend UI (i.e. eth-netstats) running in background
  • "WS_SECRET": The secret used to allow the frontend to connect eth-net-intelligence-api. You choose any value to put here.

In app.json, we have to modify three parameters, namely INSTANCE_NAME, WS_SERVERandWS_SECRET.

You can get INSTANCE_NAME from private chain information.


WS_SERVER will point eth-netstats so we use eth-netstats' default url :http://localhost:3000

We set WS_SECRET = "mysecret"

Finally app.json

4. Start The Node App

4.1 We execute the backend tool ( eth-net-intelligence-api ) run the following command:

C:\eth-net-intelligence-api> pm2 start app.json

Result

4.2 execute the front-end tool (eth-netstats ) run the following command:

C:\eth-netstats> set WS_SECRET=mysecret&& npm start

4.3 Issues:

You might encounter two issues- No action and wrong auth

4.3.1 No action

solution :

My solution is restart eth-net-intelligence-api again

C:\eth-net-intelligence-api> pm2 start app.json
or C:\eth-net-intelligence-api> pm2 restart <App name>

4.3.2 wrong auth as the following figure.

solution :

My solution is check my command and ws_secret, restart eth-net-intelligence-api and then run my eth-netstats command again.

C:\eth-netstats> set WS_SECRET=mysecret&& npm start

5. Start the Frontend

visit http://localhost:3000 in your web browser. If you notice that no node are listed in the monitoring dashboard. This is because no instance of geth is currently running or your eth-net-intelligence-api does not connect to the node.

Any problem ??

watch my video — https://www.youtube.com/watch?v=xgf3zQNqYVM

I do this because I love it, but if you want me to buy me a cup of coffee I won’t say no :O )

donation :

XEM : NCWZSUF4FPXJY3L3Y7657QNVBIUZ5D54F4TNJ64S

Ether : 0xf2d15dEAf62b8c4AFC0343006579E8E662c120D9

Bitcoin : 332UiyAfSXyvhqCYgDgBkNLFSf25ccNV9i

** Do CLAP, COMMENT and SHARE! I also welcome any business opportunities that arises**

Discover and read more posts from Chia Wei Hu
get started
post commentsBe the first to share your opinion
Show more replies