Skip to content

Commit 4f7608d

Browse files
committed
Adding cardano-node version and revision information
1 parent d57466e commit 4f7608d

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

liveview.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
promport=12798 # You may need to change this to match your configuration
1212
refreshrate=2 # How often (in seconds) to refresh the view
1313

14+
version=$("$(command -v cardano-node)" version)
15+
node_version=$(grep -oP '(?<=cardano-node )[0-9\.]+' <<< "${version}")
16+
node_rev=$(grep -oP '(?<=rev )[a-z0-9]+' <<< "${version}" | cut -c1-8)
17+
18+
node_version=$(printf "%14s" "$node_version")
19+
node_rev=$(printf "%14s" "$node_rev")
20+
1421
# Add some colors for "Felegance" (Fancy Elegance)
1522
REKT='\033[1;31m'
1623
GOOD='\033[0;32m'
@@ -19,12 +26,8 @@ INFO='\033[1;34m'
1926

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

25-
# peers=$(grep -oP '(?<=cardano-node_BlockFetchDecision_peers_connectedPeers_int )[0-9]+' <<< "$data")
26-
27-
2831
peers=$(grep -oP '(?<=cardano_node_BlockFetchDecision_peers_connectedPeers_int )[0-9]+' <<< "${data}")
2932
blocknum=$(grep -oP '(?<=cardano_node_ChainDB_metrics_blockNum_int )[0-9]+' <<< "${data}")
3033
epochnum=$(grep -oP '(?<=cardano_node_ChainDB_metrics_epoch_int )[0-9]+' <<< "${data}")
@@ -83,6 +86,10 @@ do
8386
echo -e '+--------------------------------------+'
8487
echo -e '| Simple Node Stats by Crypto2099 |'
8588
echo -e '+---------------------+----------------+'
89+
echo -e "| Version | ${INFO}${node_version}${NC} |"
90+
echo -e '+---------------------+----------------+'
91+
echo -e "| Revision | ${INFO}${node_rev}${NC} |"
92+
echo -e '+---------------------+----------------+'
8693
echo -e "| Peers | ${peers} |"
8794
echo -e '+---------------------+----------------+'
8895
echo -e "| Epoch / Block | ${epoch} |"

0 commit comments

Comments
 (0)