This commit is contained in:
SpudGunMan
2024-12-23 12:55:29 -08:00
parent 0536657c8e
commit 180a8261ca
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -770,7 +770,7 @@ def sysinfo(message, message_from_id, deviceID):
return "sysinfo command returns system information."
else:
if enable_runShellCmd and file_monitor_enabled:
shellData = call_external_script(message)
shellData = call_external_script(message).rstrip()
return get_sysinfo(message_from_id, deviceID) + "\n" + shellData
else:
return get_sysinfo(message_from_id, deviceID)
+2 -2
View File
@@ -9,7 +9,7 @@ free_space=$(df -h | grep ' /$' | awk '{print $4}')
cpu_usage=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1}')
ram_usage=$(free | grep Mem | awk '{print $3/$2 * 100.0}')
# if command vcgencmd is found
# if command vcgencmd is found, part of raspberrypi tools, use it to get temperature
if command -v vcgencmd &> /dev/null
then
# get temperature
@@ -17,11 +17,11 @@ then
# temp in fahrenheit
tempf=$(echo "scale=2; $temp * 9 / 5 + 32" | bc)
else
# get temperature from thermal zone
temp=$(paste <(cat /sys/class/thermal/thermal_zone*/type) <(cat /sys/class/thermal/thermal_zone*/temp) | grep "temp" | awk '{print $2/1000}' | awk '{s+=$1} END {print s/NR}')
tempf=$(echo "scale=2; $temp * 9 / 5 + 32" | bc)
fi
# print telemetry data
printf "Free Space: %s\n" "$free_space"
printf "CPU Usage: %.1f%%\n" "$cpu_usage"