-
-
Save jostyee/360a665ea69c6d678c8653a9c3cb1bb6 to your computer and use it in GitHub Desktop.
Shell script to print stats about a Raspberry running pihole
This file contains hidden or 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
# Gather system details. | |
dt=$(date -R) | |
freq=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq) | |
volts=$(sudo /opt/vc/bin/vcgencmd measure_volts) | |
temp=$(sudo /opt/vc/bin/vcgencmd measure_temp) | |
gov=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor) | |
up=$(uptime) | |
# Print System details | |
echo " " | |
echo -e "\e[42m$dt\e[0m" | |
echo " " | |
echo "$volts" | |
echo "$temp" | |
# sudo /opt/vc/bin/vcgencmd measure_clock | |
freq=$((freq/1000)) | |
echo -e "CPU Governor=\e[91m$gov\e[0m" | |
echo -e "Current speed=\e[96m$freq MHz\e[0m" | |
echo " " | |
# Print free & used RAM | |
echo "RAM" | |
free | awk '/Mem/{printf("%.2f MB used\n"), $3/1024}' | |
free | awk '/Mem/{printf("%.2f MB free\n"), $4/1024}' | |
# print pihole status directly from pihole CLI | |
echo " " | |
pihole status | |
echo " " | |
# Check system status. | |
# Requires package dnsutils on linux. | |
dig google.com +noall +stats +answer | |
echo " " | |
# print system uptime | |
echo -e "\e[101m $up \e[0m" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment