Skip to content

Instantly share code, notes, and snippets.

@markziemann
Created January 13, 2022 01:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markziemann/23e63813af17686468528cea7d5381e6 to your computer and use it in GitHub Desktop.
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
#!/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