Created
January 13, 2022 01:45
-
-
Save markziemann/23e63813af17686468528cea7d5381e6 to your computer and use it in GitHub Desktop.
A simple bash script for monitoring the health of a bitcoin node running on raspberry pi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
x(){ | |
echo "========================================================" | |
} | |
export -f x | |
node_dash(){ | |
clear | |
echo -n "BITCOIN NODE INFO " | |
date | |
x | |
echo -n "Uptime " | |
uptime | |
x | |
echo -n "Memory" | |
free -h | |
x | |
echo -n "CPU temperature " | |
vcgencmd measure_temp | |
x | |
echo -n "CPU Freq (MHz)=" | |
freq=$(vcgencmd measure_clock arm) | |
freq=$(echo $freq | cut -d '=' -f2) | |
echo $freq | awk '{print $1/1000000}' | |
x | |
echo "Disk space" | |
df -h ~/.bitcoin | |
x | |
echo "Bitcoin daemon activity" | |
top -bn1 > out.txt | |
egrep '(%CPU|bitcoin)' out.txt | column -t | |
x | |
echo "Node info" | |
bitcoin-cli -getinfo | grep -v '{' | grep -v '}' | tr -d '"' | tr -d ',' | |
x | |
echo "Mempool info" | |
bitcoin-cli getmempoolinfo | grep -v '{' | grep -v '}' | tr -d '"' | tr -d ',' | |
x | |
echo "Node log latest" | |
tail -5 ~/.bitcoin/debug.log | |
} | |
export -f node_dash | |
while true; do | |
node_dash | |
sleep 10 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment