From 4f7608d90d471bbf88167b317a22d4b07c49d47d Mon Sep 17 00:00:00 2001 From: "Crypto2099, Corp" Date: Sun, 23 Aug 2020 07:07:33 +0000 Subject: [PATCH] Adding cardano-node version and revision information --- liveview.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/liveview.sh b/liveview.sh index f627fbb..80d2ffb 100755 --- a/liveview.sh +++ b/liveview.sh @@ -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' @@ -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}") @@ -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} |"