Skip to content

Commit

Permalink
Adding cardano-node version and revision information
Browse files Browse the repository at this point in the history
  • Loading branch information
Crypto2099 committed Aug 23, 2020
1 parent d57466e commit 4f7608d
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions liveview.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
promport=12798 # You may need to change this to match your configuration
refreshrate=2 # How often (in seconds) to refresh the view

version=$("$(command -v cardano-node)" version)
node_version=$(grep -oP '(?<=cardano-node )[0-9\.]+' <<< "${version}")
node_rev=$(grep -oP '(?<=rev )[a-z0-9]+' <<< "${version}" | cut -c1-8)

node_version=$(printf "%14s" "$node_version")
node_rev=$(printf "%14s" "$node_rev")

# Add some colors for "Felegance" (Fancy Elegance)
REKT='\033[1;31m'
GOOD='\033[0;32m'
Expand All @@ -19,12 +26,8 @@ INFO='\033[1;34m'

while true
do
# data=$(curl -s "localhost:${promport}/metrics")
data=$(curl localhost:12798/metrics 2>/dev/null)

# peers=$(grep -oP '(?<=cardano-node_BlockFetchDecision_peers_connectedPeers_int )[0-9]+' <<< "$data")


peers=$(grep -oP '(?<=cardano_node_BlockFetchDecision_peers_connectedPeers_int )[0-9]+' <<< "${data}")
blocknum=$(grep -oP '(?<=cardano_node_ChainDB_metrics_blockNum_int )[0-9]+' <<< "${data}")
epochnum=$(grep -oP '(?<=cardano_node_ChainDB_metrics_epoch_int )[0-9]+' <<< "${data}")
Expand Down Expand Up @@ -83,6 +86,10 @@ do
echo -e '+--------------------------------------+'
echo -e '| Simple Node Stats by Crypto2099 |'
echo -e '+---------------------+----------------+'
echo -e "| Version | ${INFO}${node_version}${NC} |"
echo -e '+---------------------+----------------+'
echo -e "| Revision | ${INFO}${node_rev}${NC} |"
echo -e '+---------------------+----------------+'
echo -e "| Peers | ${peers} |"
echo -e '+---------------------+----------------+'
echo -e "| Epoch / Block | ${epoch} |"
Expand Down

0 comments on commit 4f7608d

Please sign in to comment.