mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-24 14:51:03 +01:00
parent
c6c8989f01
commit
53319ce19e
8 changed files with 18 additions and 393 deletions
|
@ -338,11 +338,8 @@ $lastLine
|
||||||
"CPU load${load##up*, }" "${tempC}" "${tempF}" \
|
"CPU load${load##up*, }" "${tempC}" "${tempF}" \
|
||||||
"${hdd}" "${sync_percentage}"
|
"${hdd}" "${sync_percentage}"
|
||||||
|
|
||||||
source /home/admin/stresstest.report 2>/dev/null
|
|
||||||
if [ ${#undervoltageReports} -gt 0 ] && [ "${undervoltageReports}" != "0" ]; then
|
if [ ${#undervoltageReports} -gt 0 ] && [ "${undervoltageReports}" != "0" ]; then
|
||||||
echo "${undervoltageReports} undervoltage reports - run 'Hardware Test' in menu"
|
echo "${undervoltageReports} undervoltage reports - run 'Hardware Test' in menu"
|
||||||
elif [ ${#powerFAIL} -gt 0 ] && [ ${powerFAIL} -gt 0 ]; then
|
|
||||||
echo "Weak power supply detected - run 'Hardware Test' in menu"
|
|
||||||
elif [ ${#ups} -gt 1 ] && [ "${upsStatus}" = "n/a" ]; then
|
elif [ ${#ups} -gt 1 ] && [ "${upsStatus}" = "n/a" ]; then
|
||||||
echo "UPS service activated but not running"
|
echo "UPS service activated but not running"
|
||||||
else
|
else
|
||||||
|
|
|
@ -171,10 +171,6 @@ while :
|
||||||
elif [ "${state}" = "sdtoosmall" ]; then
|
elif [ "${state}" = "sdtoosmall" ]; then
|
||||||
message="SDCARD TOO SMALL - min 16GB"
|
message="SDCARD TOO SMALL - min 16GB"
|
||||||
|
|
||||||
# when old data - improve message
|
|
||||||
elif [ "${state}" = "olddata" ]; then
|
|
||||||
message="login for manual migration"
|
|
||||||
|
|
||||||
# when no HDD - improve message
|
# when no HDD - improve message
|
||||||
elif [ "${state}" = "noHDD" ]; then
|
elif [ "${state}" = "noHDD" ]; then
|
||||||
message="Connect external HDD/SSD"
|
message="Connect external HDD/SSD"
|
||||||
|
|
|
@ -322,50 +322,24 @@ if [ ${#setupStep} -eq 0 ]; then
|
||||||
fi
|
fi
|
||||||
if [ ${setupStep} -eq 0 ]; then
|
if [ ${setupStep} -eq 0 ]; then
|
||||||
|
|
||||||
# check data from boostrap
|
|
||||||
# TODO: when olddata --> CLEAN OR MANUAL-UPDATE-INFO
|
|
||||||
if [ "${state}" = "olddata" ]; then
|
|
||||||
|
|
||||||
# old data setup
|
# start setup
|
||||||
BACKTITLE="RaspiBlitz - Manual Update"
|
BACKTITLE="RaspiBlitz - Setup"
|
||||||
TITLE="⚡ Found old RaspiBlitz Data on HDD ⚡"
|
TITLE="⚡ Welcome to your RaspiBlitz ⚡"
|
||||||
MENU="\n ATTENTION: OLD DATA COULD CONTAIN FUNDS\n"
|
MENU="\nChoose how you want to setup your RaspiBlitz: \n "
|
||||||
OPTIONS+=(MANUAL "read how to recover your old funds")
|
OPTIONS+=(BITCOIN "Setup BITCOIN and Lightning (DEFAULT)" \
|
||||||
HEIGHT=11
|
LITECOIN "Setup LITECOIN and Lightning (EXPERIMENTAL)" \
|
||||||
|
MIGRATION "Upload a Migration File from old RaspiBlitz" )
|
||||||
else
|
HEIGHT=12
|
||||||
isRaspbian=$(cat /etc/os-release 2>/dev/null | grep -c 'Raspbian')
|
|
||||||
if [ ${isRaspbian} -gt 0 ]; then
|
|
||||||
# show hardware test
|
|
||||||
/home/admin/05hardwareTest.sh
|
|
||||||
|
|
||||||
# start setup
|
|
||||||
BACKTITLE="RaspiBlitz - Setup"
|
|
||||||
TITLE="⚡ Welcome to your RaspiBlitz ⚡"
|
|
||||||
MENU="\nChoose how you want to setup your RaspiBlitz: \n "
|
|
||||||
OPTIONS+=(BITCOIN "Setup BITCOIN and Lightning (DEFAULT)" \
|
|
||||||
LITECOIN "Setup LITECOIN and Lightning (EXPERIMENTAL)" \
|
|
||||||
MIGRATION "Upload a Migration File from old RaspiBlitz" )
|
|
||||||
HEIGHT=12
|
|
||||||
else
|
|
||||||
# start setup
|
|
||||||
BACKTITLE="RaspiBlitz - Setup"
|
|
||||||
TITLE="⚡ Welcome to your RaspiBlitz ⚡"
|
|
||||||
MENU="\nStart to setup your RaspiBlitz: \n "
|
|
||||||
OPTIONS+=(BITCOIN "Setup BITCOIN and Lightning" \
|
|
||||||
MIGRATION "Upload a Migration File from old RaspiBlitz")
|
|
||||||
HEIGHT=11
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
elif [ ${setupStep} -lt 100 ]; then
|
elif [ ${setupStep} -lt 100 ]; then
|
||||||
|
|
||||||
# continue setup
|
# continue setup
|
||||||
BACKTITLE="${hostname} / ${network} / ${chain}"
|
BACKTITLE="${hostname} / ${network} / ${chain}"
|
||||||
TITLE="⚡ Welcome to your RaspiBlitz ⚡"
|
TITLE="⚡ Welcome to your RaspiBlitz ⚡"
|
||||||
MENU="\nThe setup process is not finished yet: \n "
|
MENU="\nThe setup process is not finished yet: \n "
|
||||||
OPTIONS+=(CONTINUE "Continue Setup of your RaspiBlitz")
|
OPTIONS+=(CONTINUE "Continue Setup of your RaspiBlitz")
|
||||||
HEIGHT=10
|
HEIGHT=10
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
|
|
|
@ -1,176 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# A solid hardware setup is important to garantuee stability of data
|
|
||||||
# This script checks the hardware and gives user feedback.
|
|
||||||
|
|
||||||
# Start with parameter "no-new-stresstest" to just use the already
|
|
||||||
# made stresstest report during boostrap script.
|
|
||||||
|
|
||||||
# INFOFILE - state data from bootstrap
|
|
||||||
source /home/admin/raspiblitz.info
|
|
||||||
source /home/admin/_version.info
|
|
||||||
|
|
||||||
clear
|
|
||||||
echo "*** Hardware Test Report ***"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# check for parameter
|
|
||||||
parameter="$1"
|
|
||||||
|
|
||||||
if [ "${parameter}" != "no-new-stresstest" ]; then
|
|
||||||
sudo /home/admin/config.scripts/blitz.stresstest.sh /home/admin/stresstest.report
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# load the stresstest values
|
|
||||||
source /home/admin/stresstest.report
|
|
||||||
|
|
||||||
#########################
|
|
||||||
# Explain Report to User
|
|
||||||
#########################
|
|
||||||
|
|
||||||
# check for power issues
|
|
||||||
showPowerImproveInfo=0
|
|
||||||
if [ ${powerWARN} -gt 0 ]; then
|
|
||||||
showPowerImproveInfo=1
|
|
||||||
if [ ${powerFAIL} -gt 0 ]; then
|
|
||||||
whiptail --backtitle "RaspiBlitz v${codeVersion} - ${powerMIN}" --title " POWER SUPPLY CRITICAL " --msgbox "
|
|
||||||
Your power supply was FAILING the stress test (${powerMIN}).
|
|
||||||
Most reports of data loss are caused by weak power supplies.
|
|
||||||
Also a lot of RaspiBlitz setups fail because of weak power supplies.
|
|
||||||
To SHUTDOWN and upgrade the Power Supply is HIGHLY RECOMMENDED.
|
|
||||||
|
|
||||||
See upcomming screen on detailed info how to improve on power supply.
|
|
||||||
|
|
||||||
" 14 78
|
|
||||||
else
|
|
||||||
whiptail --backtitle "RaspiBlitz v${codeVersion} - ${powerMIN}" --title " Power Supply Warning " --msgbox "
|
|
||||||
Your power supply seems OK - but could be better for stable operations.
|
|
||||||
A replacement/upgrade of the Power Supply is recommended if possible.
|
|
||||||
Because most reports of data loss are caused by weak power supplies.
|
|
||||||
|
|
||||||
See upcomming screen on detailed info how to improve on power supply.
|
|
||||||
|
|
||||||
" 12 78
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ${#undervoltageReports} -gt 0 ]; then
|
|
||||||
if [ ${undervoltageReports} -gt 0 ]; then
|
|
||||||
showPowerImproveInfo=1
|
|
||||||
whiptail --backtitle "RaspiBlitz v${codeVersion}" --title " Runtime Undervoltages Detected " --msgbox "
|
|
||||||
Already during runtime of RaspiBlitz Undervoltage Reports were detected.
|
|
||||||
A upgrade of the Power Supply is strongly recommended (see next screen).
|
|
||||||
|
|
||||||
You should see the number of outages on your LCD as an ongoing counting.
|
|
||||||
Note that after replacement of power supply this number is not set to 0.
|
|
||||||
As long that counting is not going further up you are good.
|
|
||||||
|
|
||||||
" 13 78
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ${showPowerImproveInfo} -gt 0 ]; then
|
|
||||||
|
|
||||||
whiptail --backtitle "RaspiBlitz v${codeVersion}" --title " What todo on Power Issues " --msgbox "
|
|
||||||
To improve on power issues an upgrade of the power supply is recommended.
|
|
||||||
Check if you have the latest power supply listed in your shopping list.
|
|
||||||
If you have that one, please report on GitHub that alternative is needed.
|
|
||||||
|
|
||||||
In general a good power supply needs to fullfill this three points:
|
|
||||||
- needs to deliver at least 3 Ampere
|
|
||||||
- needs to deliver a stable >=5V output (big & clunky is good)
|
|
||||||
- needs a thick cable (low AWG score) & best is no switch
|
|
||||||
|
|
||||||
If you think all is good with your power supply please also re-run test
|
|
||||||
up to 3 times. Sometimes a good power supply has 1 or 2 bad measurements.
|
|
||||||
|
|
||||||
" 18 78
|
|
||||||
|
|
||||||
choice=$(whiptail --backtitle "RaspiBlitz v${codeVersion}" --title " Hardware Check " --menu "What todo about Power Issues?" 12 60 6 \
|
|
||||||
TESTAGAIN "Run Test again to be sure." \
|
|
||||||
CONTINUE "I take the risk - continue." \
|
|
||||||
SHUTDOWN "Shutdown to change hardware." 3>&1 1>&2 2>&3)
|
|
||||||
if [ ${#choice} -eq 0 ]; then
|
|
||||||
choice="CONTINUE"
|
|
||||||
fi
|
|
||||||
if [ "${choice}" == "TESTAGAIN" ]; then
|
|
||||||
echo "Shutting down ..."
|
|
||||||
sudo /home/admin/05hardwareTest.sh
|
|
||||||
exit 0
|
|
||||||
elif [ "${choice}" == "SHUTDOWN" ]; then
|
|
||||||
echo "Shutting down ..."
|
|
||||||
sudo shutdown now
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "OK continue .."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check for heat issues
|
|
||||||
showHeatImproveInfo=0
|
|
||||||
if [ ${tempWARN} -gt 0 ]; then
|
|
||||||
showHeatImproveInfo=1
|
|
||||||
if [ ${tempFAIL} -gt 0 ]; then
|
|
||||||
whiptail --backtitle "RaspiBlitz v${codeVersion} - ${tempMAX}" --title " HEAT MANAGEMENT CRITICAL " --msgbox "
|
|
||||||
Your RaspiBlitz is getting MUCH TOO HOT (${tempMAX}).
|
|
||||||
The system is getting very slow when hot - thats not a NO GO but bad.
|
|
||||||
An upgrade of the Heat Management is HIGHLY RECOMMENDED.
|
|
||||||
|
|
||||||
See upcomming screen on detailed info how to improve heat management.
|
|
||||||
|
|
||||||
" 12 78
|
|
||||||
else
|
|
||||||
whiptail --backtitle "RaspiBlitz v${codeVersion} - ${tempMAX}" --title " Heat Management Warning " --msgbox "
|
|
||||||
Your RaspiBlitz is getting a bit too hot (${tempMAX}).
|
|
||||||
The system is getting slow when hot - thats not a NO GO but bad.
|
|
||||||
An upgrade of the Heat Management is recommended if possible.
|
|
||||||
|
|
||||||
See upcomming screen on detailed info how to improve heat management.
|
|
||||||
|
|
||||||
" 12 78
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ${showHeatImproveInfo} -gt 0 ]; then
|
|
||||||
|
|
||||||
whiptail --backtitle "RaspiBlitz v${codeVersion}" --title " What todo on Heat Issues " --msgbox "
|
|
||||||
To improve on heat issues an upgrade of the casing is recommended.
|
|
||||||
Check if you have the latest casing options in your shopping list.
|
|
||||||
Use a big passive heat sink or fan to prevent overheating.
|
|
||||||
If you have already one, check if its applied correctly to CPU.
|
|
||||||
In extreme cases consider some external fan helping out.
|
|
||||||
|
|
||||||
Again a RaspiBlitz getting hot can be tolerated. But it is
|
|
||||||
slowing down your CPU and may reduce the lifetime of hardware.
|
|
||||||
|
|
||||||
" 16 72
|
|
||||||
|
|
||||||
choice=$(whiptail --backtitle "RaspiBlitz v${codeVersion}" --title " Hardware Check " --menu "What todo about Heat Issues?" 12 60 6 \
|
|
||||||
TESTAGAIN "Run Test again to be sure." \
|
|
||||||
CONTINUE "I take the risk - continue." \
|
|
||||||
SHUTDOWN "Shutdown to change hardware." 3>&1 1>&2 2>&3)
|
|
||||||
if [ ${#choice} -eq 0 ]; then
|
|
||||||
choice="CONTINUE"
|
|
||||||
fi
|
|
||||||
if [ "${choice}" == "TESTAGAIN" ]; then
|
|
||||||
echo "Shutting down ..."
|
|
||||||
sudo /home/admin/05hardwareTest.sh
|
|
||||||
exit 0
|
|
||||||
elif [ "${choice}" == "SHUTDOWN" ]; then
|
|
||||||
echo "Shutting down ..."
|
|
||||||
sudo shutdown now
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "OK continue .."
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ${showPowerImproveInfo} -eq 0 ] && [ ${showHeatImproveInfo} -eq 0 ]; then
|
|
||||||
dialog --backtitle "RaspiBlitz v${codeVersion}" --title " Hardware Check " --msgbox "
|
|
||||||
RaspiBlitz hardware setup looks good :)
|
|
||||||
You are ready to continue - have fun.
|
|
||||||
|
|
||||||
" 8 43
|
|
||||||
fi
|
|
|
@ -164,8 +164,8 @@ if [ "$1" == "sourcemode" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Basic Options
|
# Basic Options
|
||||||
OPTIONS=(HARDWARE "Run Hardwaretest" \
|
#OPTIONS=(HARDWARE "Run Hardwaretest" \
|
||||||
SOFTWARE "Run Softwaretest (DebugReport)" \
|
OPTIONS=(SOFTWARE "Run Softwaretest (DebugReport)" \
|
||||||
BACKUP-LND "Backup your LND data (Rescue-File)" \
|
BACKUP-LND "Backup your LND data (Rescue-File)" \
|
||||||
MIGRATION "Migrate Blitz Data to new Hardware" \
|
MIGRATION "Migrate Blitz Data to new Hardware" \
|
||||||
COPY-SOURCE "Copy Blockchain Source Modus" \
|
COPY-SOURCE "Copy Blockchain Source Modus" \
|
||||||
|
@ -181,9 +181,8 @@ CHOICE=$(whiptail --clear --title "Repair Options" --menu "" 18 62 11 "${OPTIONS
|
||||||
|
|
||||||
clear
|
clear
|
||||||
case $CHOICE in
|
case $CHOICE in
|
||||||
HARDWARE)
|
# HARDWARE)
|
||||||
sudo /home/admin/05hardwareTest.sh
|
# ;;
|
||||||
;;
|
|
||||||
SOFTWARE)
|
SOFTWARE)
|
||||||
sudo /home/admin/XXdebugLogs.sh
|
sudo /home/admin/XXdebugLogs.sh
|
||||||
echo "Press ENTER to return to main menu."
|
echo "Press ENTER to return to main menu."
|
||||||
|
|
|
@ -193,21 +193,6 @@ if [ ${#undervoltageReports} -gt 0 ]; then
|
||||||
showImproveInfo=1
|
showImproveInfo=1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -f /home/admin/stresstest.report ]; then
|
|
||||||
sudo cat /home/admin/stresstest.report
|
|
||||||
source /home/admin/stresstest.report
|
|
||||||
if [ ${powerWARN} -gt 0 ]; then
|
|
||||||
showImproveInfo=1
|
|
||||||
fi
|
|
||||||
if [ ${tempWARN} -gt 0 ]; then
|
|
||||||
showImproveInfo=1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ ${showImproveInfo} -gt 0 ]; then
|
|
||||||
echo "IMPORTANT: There are some hardware issues with your setup."
|
|
||||||
echo "'Run Hardwaretest' in main menu or: sudo /home/admin/05hardwareTest.sh"
|
|
||||||
fi
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
echo "*** SYSTEM STATUS (can take some seconds to gather) ***"
|
echo "*** SYSTEM STATUS (can take some seconds to gather) ***"
|
||||||
sudo /home/admin/config.scripts/blitz.statusscan.sh
|
sudo /home/admin/config.scripts/blitz.statusscan.sh
|
||||||
|
|
|
@ -600,22 +600,6 @@ else
|
||||||
sudo chown admin:admin /mnt/hdd/app-data/subscriptions
|
sudo chown admin:admin /mnt/hdd/app-data/subscriptions
|
||||||
fi
|
fi
|
||||||
|
|
||||||
################################
|
|
||||||
# STRESSTEST RASPBERRY PI
|
|
||||||
################################
|
|
||||||
|
|
||||||
if [ "${baseimage}" = "raspbian" ] || [ "${baseimage}" = "raspios_arm64" ]; then
|
|
||||||
# generate stresstest report on every startup (in case hardware has changed)
|
|
||||||
sed -i "s/^state=.*/state=stresstest/g" ${infoFile}
|
|
||||||
sed -i "s/^message=.*/message='Testing Hardware 60s'/g" ${infoFile}
|
|
||||||
sudo /home/admin/config.scripts/blitz.stresstest.sh /home/admin/stresstest.report
|
|
||||||
source /home/admin/stresstest.report
|
|
||||||
if [ "${powerWARN}" = "0" ]; then
|
|
||||||
# https://github.com/rootzoll/raspiblitz/issues/576
|
|
||||||
echo "" > /var/log/syslog
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# mark that node is ready now
|
# mark that node is ready now
|
||||||
sed -i "s/^state=.*/state=ready/g" ${infoFile}
|
sed -i "s/^state=.*/state=ready/g" ${infoFile}
|
||||||
sed -i "s/^message=.*/message='Node Running'/g" ${infoFile}
|
sed -i "s/^message=.*/message='Node Running'/g" ${infoFile}
|
||||||
|
|
|
@ -1,134 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# command info
|
|
||||||
if [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
|
||||||
echo "run stress test to measure heat and voltage"
|
|
||||||
echo "blitz.stresstest.sh [?filenameForReport]"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
isRaspbian=$(cat /etc/os-release 2>/dev/null | grep -c 'Raspbian')
|
|
||||||
if [ ${isRaspbian} -eq 0 ]; then
|
|
||||||
echo "the OS is not Raspbian - the stresstest is only for the Raspberry Pi"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Based on https://github.com/bamarni/pi64/issues/4#issuecomment-292707581
|
|
||||||
# sysbench manual: http://imysql.com/wp-content/uploads/2014/10/sysbench-manual.pdf
|
|
||||||
|
|
||||||
# get parameter
|
|
||||||
filenameForReport=$1
|
|
||||||
|
|
||||||
# check if bechmarking tool is installed
|
|
||||||
sysbenchInstalled=$(sysbench --version 2>/dev/null | grep -c 'sysbench 0.')
|
|
||||||
if [ ${sysbenchInstalled} -eq 0 ];then
|
|
||||||
sudo apt install -y sysbench
|
|
||||||
fi
|
|
||||||
|
|
||||||
# do debug outputs to the STDERR - so that the STDOUT is just the results in the end
|
|
||||||
echo "RaspiBlitz Hardwaretest v0.2" >&2
|
|
||||||
|
|
||||||
# detect hardware version of RaspberryPi
|
|
||||||
# https://www.unixtutorial.org/command-to-confirm-raspberry-pi-model
|
|
||||||
raspberryPi=$(cat /proc/device-tree/model | cut -d " " -f 3 | sed 's/[^0-9]*//g')
|
|
||||||
if [ ${#raspberryPi} -eq 0 ]; then
|
|
||||||
raspberryPi=0
|
|
||||||
fi
|
|
||||||
echo "RaspberryPi Model Version: ${raspberryPi}"
|
|
||||||
if [ ${raspberryPi} -lt 4 ]; then
|
|
||||||
# raspberryPi 3 and lower (microUSB power connector)
|
|
||||||
voltWARN=1230000
|
|
||||||
voltFAIL=1200100
|
|
||||||
tempWARNING=6500
|
|
||||||
tempCRTICAL=6999
|
|
||||||
else
|
|
||||||
# raspberryPi 4 and up (USB-C power connector)
|
|
||||||
voltWARN=833200
|
|
||||||
voltFAIL=823200
|
|
||||||
tempWARNING=6900
|
|
||||||
tempCRTICAL=7799
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Starting sysbench to run for 60 seconds (--max-time=60 --cpu-max-prime=100000)" >&2
|
|
||||||
|
|
||||||
# result values
|
|
||||||
powerWARN=0
|
|
||||||
powerFAIL=0
|
|
||||||
powerMIN=9999999
|
|
||||||
tempWARN=0
|
|
||||||
tempFAIL=0
|
|
||||||
tempMAX=0
|
|
||||||
|
|
||||||
# starting bench mark
|
|
||||||
sysbench --max-time=60 --test=cpu --cpu-max-prime=100000 --num-threads=4 run 1>/dev/null 2>&1 &
|
|
||||||
|
|
||||||
# keep monitoring in the background
|
|
||||||
Maxfreq=$(( $(awk '{printf ("%0.0f",$1/1000); }' </sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq) -15 ))
|
|
||||||
for (( n=0; n<15; ++n )); do
|
|
||||||
|
|
||||||
# make measurements
|
|
||||||
Temp=$(sudo vcgencmd measure_temp | cut -f2 -d=)
|
|
||||||
RealClockspeed=$(sudo vcgencmd measure_clock arm | awk -F"=" '{printf ("%0.0f",$2/1000000); }' )
|
|
||||||
SysFSClockspeed=$(awk '{printf ("%0.0f",$1/1000); }' </sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq)
|
|
||||||
CoreVoltage=$(sudo vcgencmd measure_volts | cut -f2 -d= | sed 's/000//')
|
|
||||||
|
|
||||||
# debug output
|
|
||||||
if [ ${RealClockspeed} -ge ${Maxfreq} ]; then
|
|
||||||
echo "${Temp}$(printf "%5s" ${SysFSClockspeed}) MHz ${CoreVoltage}" >&2
|
|
||||||
else
|
|
||||||
echo "${Temp}$(printf "%5s" ${RealClockspeed})/$(printf "%4s" ${SysFSClockspeed}) MHz ${CoreVoltage}" >&2
|
|
||||||
fi
|
|
||||||
|
|
||||||
# analyse Voltage
|
|
||||||
voltFloat=$(echo "${CoreVoltage/V/}*1000000" | bc)
|
|
||||||
voltInt=${voltFloat/.*}
|
|
||||||
#echo "V -> ${voltFloat}/${voltInt}"
|
|
||||||
if [ ${voltInt} -lt ${voltFAIL} ] && [ ${powerWARN} -gt 1 ]; then
|
|
||||||
((powerFAIL=powerFAIL+1))
|
|
||||||
echo "--> Power CRITICAL detected" >&2
|
|
||||||
fi
|
|
||||||
if [ ${voltInt} -lt ${voltWARN} ]; then
|
|
||||||
((powerWARN=powerWARN+1))
|
|
||||||
echo "--> Power WARN detected" >&2
|
|
||||||
fi
|
|
||||||
if [ ${voltInt} -lt ${powerMIN} ]; then
|
|
||||||
powerMIN=${voltInt}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# analyse Temp
|
|
||||||
tempFloat=$(echo "${Temp/\'C/}*100" | bc)
|
|
||||||
tempInt=${tempFloat/.*}
|
|
||||||
#echo "T -> ${tempFloat}/${tempInt}"
|
|
||||||
if [ ${tempInt} -gt ${tempCRTICAL} ]; then
|
|
||||||
((tempFAIL=tempFAIL+1))
|
|
||||||
echo "--> Temp CRITICAL detected" >&2
|
|
||||||
fi
|
|
||||||
if [ ${tempInt} -gt ${tempWARNING} ]; then
|
|
||||||
((tempWARN=tempWARN+1))
|
|
||||||
echo "--> Temp WARN detected" >&2
|
|
||||||
fi
|
|
||||||
if [ ${tempInt} -gt ${tempMAX} ]; then
|
|
||||||
tempMAX=${tempInt}
|
|
||||||
fi
|
|
||||||
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ${#filenameForReport} -eq 0 ]; then
|
|
||||||
echo "raspberryPi=${raspberryPi}"
|
|
||||||
echo "powerFAIL=${powerFAIL}"
|
|
||||||
echo "powerWARN=${powerWARN}"
|
|
||||||
echo "powerMIN='${powerMIN} microVolt'"
|
|
||||||
echo "tempFAIL=${tempFAIL}"
|
|
||||||
echo "tempWARN=${tempWARN}"
|
|
||||||
echo "tempMAX='${tempMAX} centiGrad'"
|
|
||||||
else
|
|
||||||
echo "raspberryPi=${raspberryPi}" >${filenameForReport}
|
|
||||||
echo "powerFAIL=${powerFAIL}" >>${filenameForReport}
|
|
||||||
echo "powerWARN=${powerWARN}" >>${filenameForReport}
|
|
||||||
echo "powerMIN='${powerMIN} microVolt'" >>${filenameForReport}
|
|
||||||
echo "tempFAIL=${tempFAIL}" >>${filenameForReport}
|
|
||||||
echo "tempWARN=${tempWARN}" >>${filenameForReport}
|
|
||||||
echo "tempMAX='${tempMAX} centiGrad'" >>${filenameForReport}
|
|
||||||
sudo chmod 744 ${filenameForReport}
|
|
||||||
fi
|
|
Loading…
Add table
Reference in a new issue