From 8057d49be049c85a45c2b07c0533e6d1cf753db9 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Tue, 8 Aug 2023 03:58:08 +0200 Subject: [PATCH] Update systeminfo.php Updated the "Memory Statistics" formula variables Updated "Memory Statistics" echo variables Added new formula variables for "CPU Temp" Modified section "General" Added new section "System" Added new section "CPU" Added new section "Memory" --- front/systeminfo.php | 167 +++++++++++++++++++++++++++---------------- 1 file changed, 106 insertions(+), 61 deletions(-) diff --git a/front/systeminfo.php b/front/systeminfo.php index c0f58eed..7a168695 100644 --- a/front/systeminfo.php +++ b/front/systeminfo.php @@ -63,12 +63,15 @@ if (file_exists('/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq')) { // Fallback $stat['cpu_frequ'] = "unknown"; } +$cpu_temp = shell_exec('cat /sys/class/thermal/thermal_zone0/temp'); // Get the CPU temperature +$cpu_temp = floatval($cpu_temp) / 1000; // Convert the temperature to degrees Celsius //Memory stats -$total_memory = shell_exec("cat /proc/meminfo | grep MemTotal | cut -d' ' -f2-") / 1024 | bc; -$mem_result = shell_exec("cat /proc/meminfo | grep MemTotal"); -$stat['mem_total'] = round(preg_replace("#[^0-9]+(?:\.[0-9]*)?#", "", $mem_result) / 1024 / 1024, 3); -$stat['mem_used'] = round(memory_get_usage() / 1048576 * 100, 2); -$memory_usage_percent = round(($stat['mem_used'] / $stat['mem_total']), 2); +$total_memorykb = shell_exec("cat /proc/meminfo | grep MemTotal | awk '{print $2}'"); +$total_memorykb = number_format($total_memorykb, 0, '.', '.'); +$total_memorymb = shell_exec("cat /proc/meminfo | grep MemTotal | awk '{print $2/1024}'"); +$total_memorymb = number_format($total_memorymb, 0, '.', '.'); +$mem_used = round(memory_get_usage() / 1048576 * 100, 2); +$memory_usage_percent = round(($mem_used / $total_memorymb), 2); //Load System $load_average = sys_getloadavg(); //Date & Time @@ -106,71 +109,113 @@ echo '