From 2b9323ac984326134a60d97462740215212c6ab0 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Wed, 6 Sep 2023 15:45:11 +0200 Subject: [PATCH 01/15] Update systeminfo.php Added new function "system_process_count" to see the number of processes executed in the system --- front/systeminfo.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/front/systeminfo.php b/front/systeminfo.php index be34e2d5..54280bbc 100755 --- a/front/systeminfo.php +++ b/front/systeminfo.php @@ -89,6 +89,8 @@ $system_namesystem = shell_exec("uname -o"); $system_full = shell_exec("uname -a"); $system_architecture = shell_exec("uname -m"); $load_average = sys_getloadavg(); +// Count processes +$system_process_count = shell_exec("ps -e --no-headers | wc -l"); //Date & Time $date = new DateTime(); $formatted_date = $date->format('l, F j, Y H:i:s'); @@ -214,6 +216,10 @@ echo '
' . lang('Systeminfo_System_AVG') . '
'. $load_average[0] .' '. $load_average[1] .' '. $load_average[2] .'
+
+
' . lang('Systeminfo_Running_Processes') . '
+
' . $system_process_count . '
+
'; From 8f155791367113f85fdc0ebfcea44a915f0214bf Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Wed, 6 Sep 2023 16:16:45 +0200 Subject: [PATCH 02/15] Update systeminfo.php Added new comments in functions Changed the order of functions --- front/systeminfo.php | 54 +++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/front/systeminfo.php b/front/systeminfo.php index 54280bbc..35ccb377 100755 --- a/front/systeminfo.php +++ b/front/systeminfo.php @@ -30,6 +30,12 @@ format('l, F j, Y H:i:s'); +$formatted_date2 = $date->format('d/m/Y H:i:s'); +$formatted_date3 = $date->format('Y/m/d H:i:s'); +//System stats // OS-Version $os_version = ''; // Raspbian @@ -39,14 +45,19 @@ if ($os_version == '') {$os_version = exec('uname -o');} //$os_version_arr = explode("\n", trim($os_version)); $stat['os_version'] = str_replace('"', '', str_replace('PRETTY_NAME=', '', $os_version)); $stat['uptime'] = str_replace('up ', '', shell_exec("uptime -p")); -//Motherboard stat +$system_namekernel = shell_exec("uname"); +$system_namesystem = shell_exec("uname -o"); +$system_full = shell_exec("uname -a"); +$system_architecture = shell_exec("uname -m"); +$load_average = sys_getloadavg(); +//Motherboard stats $motherboard_name = shell_exec('cat /sys/class/dmi/id/board_name'); // Get the Motherboard name $motherboard_manufactured = shell_exec('cat /sys/class/dmi/id/board_vendor'); // Get the Motherboard manufactured $motherboard_revision = shell_exec('cat /sys/class/dmi/id/board_version'); // Get the Motherboard revision $motherboard_bios = shell_exec('cat /sys/class/dmi/id/bios_version'); // Get the Motherboard BIOS $motherboard_biosdate = shell_exec('cat /sys/class/dmi/id/bios_date'); // Get the Motherboard BIOS date $motherboard_biosvendor = shell_exec('cat /sys/class/dmi/id/bios_vendor'); // Get the Motherboard BIOS vendor -//CPU stat +//CPU stats $prevVal = shell_exec("cat /proc/cpuinfo | grep processor"); $prevArr = explode("\n", trim($prevVal)); $stat['cpu'] = sizeof($prevArr); @@ -83,19 +94,19 @@ $total_memorymb = trim($total_memorymb); $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); -//System -$system_namekernel = shell_exec("uname"); -$system_namesystem = shell_exec("uname -o"); -$system_full = shell_exec("uname -a"); -$system_architecture = shell_exec("uname -m"); -$load_average = sys_getloadavg(); -// Count processes -$system_process_count = shell_exec("ps -e --no-headers | wc -l"); -//Date & Time -$date = new DateTime(); -$formatted_date = $date->format('l, F j, Y H:i:s'); -$formatted_date2 = $date->format('d/m/Y H:i:s'); -$formatted_date3 = $date->format('Y/m/d H:i:s'); +//HDD stats +$hdd_result = shell_exec("df | awk '{print $1}'"); +$hdd_devices = explode("\n", trim($hdd_result)); +$hdd_result = shell_exec("df | awk '{print $2}'"); +$hdd_devices_total = explode("\n", trim($hdd_result)); +$hdd_result = shell_exec("df | awk '{print $3}'"); +$hdd_devices_used = explode("\n", trim($hdd_result)); +$hdd_result = shell_exec("df | awk '{print $4}'"); +$hdd_devices_free = explode("\n", trim($hdd_result)); +$hdd_result = shell_exec("df | awk '{print $5}'"); +$hdd_devices_percent = explode("\n", trim($hdd_result)); +$hdd_result = shell_exec("df | awk '{print $6}'"); +$hdd_devices_mount = explode("\n", trim($hdd_result)); //Network stats // Check Server name if (!empty(gethostname())) { $network_NAME = gethostname(); } else { $network_NAME = lang('Systeminfo_Network_Server_Name_String'); } @@ -112,19 +123,6 @@ $network_result = shell_exec("cat /proc/net/dev | tail -n +3 | awk '{print $2}'" $net_interfaces_rx = explode("\n", trim($network_result)); $network_result = shell_exec("cat /proc/net/dev | tail -n +3 | awk '{print $10}'"); $net_interfaces_tx = explode("\n", trim($network_result)); -//HDD stats -$hdd_result = shell_exec("df | awk '{print $1}'"); -$hdd_devices = explode("\n", trim($hdd_result)); -$hdd_result = shell_exec("df | awk '{print $2}'"); -$hdd_devices_total = explode("\n", trim($hdd_result)); -$hdd_result = shell_exec("df | awk '{print $3}'"); -$hdd_devices_used = explode("\n", trim($hdd_result)); -$hdd_result = shell_exec("df | awk '{print $4}'"); -$hdd_devices_free = explode("\n", trim($hdd_result)); -$hdd_result = shell_exec("df | awk '{print $5}'"); -$hdd_devices_percent = explode("\n", trim($hdd_result)); -$hdd_result = shell_exec("df | awk '{print $6}'"); -$hdd_devices_mount = explode("\n", trim($hdd_result)); //USB devices $usb_result = shell_exec("lsusb"); $usb_devices_mount = explode("\n", trim($usb_result)); From 7581e4f63a071335d76e0a4152cb2d4eb46a8d82 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Wed, 6 Sep 2023 16:20:13 +0200 Subject: [PATCH 03/15] Update systeminfo.php Added new function "system_process_count" to see the number of processes executed in the system --- front/systeminfo.php | 1 + 1 file changed, 1 insertion(+) diff --git a/front/systeminfo.php b/front/systeminfo.php index 35ccb377..e153f6af 100755 --- a/front/systeminfo.php +++ b/front/systeminfo.php @@ -50,6 +50,7 @@ $system_namesystem = shell_exec("uname -o"); $system_full = shell_exec("uname -a"); $system_architecture = shell_exec("uname -m"); $load_average = sys_getloadavg(); +$system_process_count = shell_exec("ps -e --no-headers | wc -l"); // Count processes //Motherboard stats $motherboard_name = shell_exec('cat /sys/class/dmi/id/board_name'); // Get the Motherboard name $motherboard_manufactured = shell_exec('cat /sys/class/dmi/id/board_vendor'); // Get the Motherboard manufactured From ab59d529ec95a62bffd0caf36ea5a1212359e88f Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Wed, 6 Sep 2023 16:23:15 +0200 Subject: [PATCH 04/15] Update systeminfo.php New comments in "System stats" --- front/systeminfo.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/front/systeminfo.php b/front/systeminfo.php index e153f6af..7369326c 100755 --- a/front/systeminfo.php +++ b/front/systeminfo.php @@ -44,12 +44,12 @@ if ($os_version == '') {$os_version = exec('cat /etc/os-release | grep PRETTY_NA if ($os_version == '') {$os_version = exec('uname -o');} //$os_version_arr = explode("\n", trim($os_version)); $stat['os_version'] = str_replace('"', '', str_replace('PRETTY_NAME=', '', $os_version)); -$stat['uptime'] = str_replace('up ', '', shell_exec("uptime -p")); -$system_namekernel = shell_exec("uname"); -$system_namesystem = shell_exec("uname -o"); -$system_full = shell_exec("uname -a"); -$system_architecture = shell_exec("uname -m"); -$load_average = sys_getloadavg(); +$stat['uptime'] = str_replace('up ', '', shell_exec("uptime -p")); // Get system uptime +$system_namekernel = shell_exec("uname"); // Get system name kernel +$system_namesystem = shell_exec("uname -o"); // Get name system +$system_full = shell_exec("uname -a"); // Get system full +$system_architecture = shell_exec("uname -m"); // Get system Architecture +$load_average = sys_getloadavg(); // Get load average $system_process_count = shell_exec("ps -e --no-headers | wc -l"); // Count processes //Motherboard stats $motherboard_name = shell_exec('cat /sys/class/dmi/id/board_name'); // Get the Motherboard name From 9fe8d8a3b4c239883b780a456293f20831cedd4f Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Wed, 6 Sep 2023 16:24:37 +0200 Subject: [PATCH 05/15] Update systeminfo.php New comments in "General stats" --- front/systeminfo.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/front/systeminfo.php b/front/systeminfo.php index 7369326c..870f5905 100755 --- a/front/systeminfo.php +++ b/front/systeminfo.php @@ -29,12 +29,12 @@
format('l, F j, Y H:i:s'); -$formatted_date2 = $date->format('d/m/Y H:i:s'); -$formatted_date3 = $date->format('Y/m/d H:i:s'); +$formatted_date = $date->format('l, F j, Y H:i:s'); // Get date +$formatted_date2 = $date->format('d/m/Y H:i:s'); // Get date2 +$formatted_date3 = $date->format('Y/m/d H:i:s'); // Get date3 //System stats // OS-Version $os_version = ''; From e44bceaed591a2985edbbddc95524034b8f48bc8 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Wed, 6 Sep 2023 16:33:38 +0200 Subject: [PATCH 06/15] Update systeminfo.php Fix "Network Hardware" --- front/systeminfo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/systeminfo.php b/front/systeminfo.php index 870f5905..ac0dcf10 100755 --- a/front/systeminfo.php +++ b/front/systeminfo.php @@ -467,7 +467,7 @@ echo '
for ($x = 0; $x < sizeof($net_interfaces); $x++) { $interface_name = str_replace(':', '', $net_interfaces[$x]); - $interface_ip_temp = exec('ip addr show ' . $interface_name . ' | grep inet'); + $interface_ip_temp = exec('ip addr show ' . $interface_name . ' | grep "inet "'); $interface_ip_arr = explode(' ', trim($interface_ip_temp)); if (!isset($interface_ip_arr[1])) {$interface_ip_arr[1] = '--';} From 274f954b8afe742203b0df76e0c15c227d7e0d43 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Wed, 6 Sep 2023 16:38:45 +0200 Subject: [PATCH 07/15] Update systeminfo.php Code cleanup in the "Storage" section --- front/systeminfo.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/front/systeminfo.php b/front/systeminfo.php index ac0dcf10..b20750d3 100755 --- a/front/systeminfo.php +++ b/front/systeminfo.php @@ -341,12 +341,8 @@ for ($x = 0; $x < sizeof($storage_lsblk_line); $x++) { $temp = explode("#", $storage_lsblk_line[$x]); $storage_lsblk_line[$x] = $temp; } -// echo '
';
-// print_r($storage_lsblk_line);
-// echo '
'; for ($x = 0; $x < sizeof($storage_lsblk_line); $x++) { - //if (stristr($hdd_devices[$x], '/dev/')) { echo '
'; if (preg_match('~[0-9]+~', $storage_lsblk_line[$x][0])) { echo '
"' . lang('Systeminfo_Storage_Mount') . ' ' . $storage_lsblk_line[$x][3] . '"
'; @@ -357,7 +353,6 @@ for ($x = 0; $x < sizeof($storage_lsblk_line); $x++) { echo '
' . lang('Systeminfo_Storage_Size') . ' ' . $storage_lsblk_line[$x][1] . '
'; echo '
' . lang('Systeminfo_Storage_Type') . ' ' . $storage_lsblk_line[$x][2] . '
'; echo '
'; - //} } echo '
'; From 028c4a9cb42d0e6408c8610355d9a54fa4afcaf1 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Wed, 6 Sep 2023 16:51:19 +0200 Subject: [PATCH 08/15] Update systeminfo.php Cleaning and fixing code in the "Storage usage" section --- front/systeminfo.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/front/systeminfo.php b/front/systeminfo.php index b20750d3..d664cdc9 100755 --- a/front/systeminfo.php +++ b/front/systeminfo.php @@ -365,15 +365,17 @@ echo '
'; for ($x = 0; $x < sizeof($hdd_devices); $x++) { if (stristr($hdd_devices[$x], '/dev/')) { - if ($hdd_devices_total[$x] == 0) {$temp_total = 0;} else { $temp_total = number_format(round(($hdd_devices_total[$x] / 1024 / 1024), 2), 2, ',', '.'); $temp_total = trim($temp_total);} - if ($hdd_devices_used[$x] == 0) {$temp_used = 0;} else { $temp_used = number_format(round(($hdd_devices_used[$x] / 1024 / 1024), 2), 2, ',', '.'); $temp_used = trim($temp_total);} - if ($hdd_devices_free[$x] == 0) {$temp_free = 0;} else { $temp_free = number_format(round(($hdd_devices_free[$x] / 1024 / 1024), 2), 2, ',', '.'); $temp_free = trim($temp_total);} + if (!stristr($hdd_devices[$x], '/loop')) { + if ($hdd_devices_total[$x] == 0 || $hdd_devices_total[$x] == '') {$temp_total = 0;} else { $temp_total = number_format(round(($hdd_devices_total[$x] / 1024 / 1024), 2), 2, ',', '.'); $temp_total = trim($temp_total);} + if ($hdd_devices_used[$x] == 0 || $hdd_devices_used[$x] == '') {$temp_used = 0;} else { $temp_used = number_format(round(($hdd_devices_used[$x] / 1024 / 1024), 2), 2, ',', '.'); $temp_used = trim($temp_total);} + if ($hdd_devices_free[$x] == 0 || $hdd_devices_free[$x] == '') {$temp_free = 0;} else { $temp_free = number_format(round(($hdd_devices_free[$x] / 1024 / 1024), 2), 2, ',', '.'); $temp_free = trim($temp_total);} echo '
'; echo '
"' . lang('Systeminfo_Storage_Usage_Mount') . ' ' . $hdd_devices_mount[$x] . '"
'; echo '
' . lang('Systeminfo_Storage_Usage_Total') . ' ' . $temp_total . ' GB
'; echo '
' . lang('Systeminfo_Storage_Usage_Used') . ' ' . $temp_used . ' GB (' . $hdd_devices_percent[$x]. ')
'; echo '
' . lang('Systeminfo_Storage_Usage_Free') . ' ' . $temp_free . ' GB
'; echo '
'; + } } } #echo '
' . $lang['SysInfo_storage_note']; From e7fd39112e541d6bc100db33bb9503f1509f6521 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Wed, 6 Sep 2023 16:59:50 +0200 Subject: [PATCH 09/15] Update en_us.json Added translation variable "Systeminfo_System_Running_Processes" --- front/php/templates/language/en_us.json | 1 + 1 file changed, 1 insertion(+) diff --git a/front/php/templates/language/en_us.json b/front/php/templates/language/en_us.json index ade799d8..a8f00fda 100755 --- a/front/php/templates/language/en_us.json +++ b/front/php/templates/language/en_us.json @@ -648,6 +648,7 @@ "Systeminfo_System_AVG": "Load average:", "Systeminfo_System_Kernel": "Kernel:", "Systeminfo_System_OSVersion": "Operating System:", + "Systeminfo_System_Running_Processes" : "Running processes", "Systeminfo_System_System": "System:", "Systeminfo_System_Uname": "Uname:", "Systeminfo_System_Uptime": "Uptime:", From 949052d00ce2bf7a626c5ef3b1fc0af2ea2d6121 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Wed, 6 Sep 2023 17:01:10 +0200 Subject: [PATCH 10/15] Update es_es.json Added translation variable "Systeminfo_System_Running_Processes" --- front/php/templates/language/es_es.json | 1 + 1 file changed, 1 insertion(+) diff --git a/front/php/templates/language/es_es.json b/front/php/templates/language/es_es.json index 2aeb0296..4485f363 100755 --- a/front/php/templates/language/es_es.json +++ b/front/php/templates/language/es_es.json @@ -642,6 +642,7 @@ "Systeminfo_System_AVG": "Cargar promedio:", "Systeminfo_System_Kernel": "NĂșcleo:", "Systeminfo_System_OSVersion": "Sistema Operativo:", + "Systeminfo_System_Running_Processes" : "Procesos corriendo", "Systeminfo_System_System": "Sistema:", "Systeminfo_System_Uname": "Uname:", "Systeminfo_System_Uptime": "Tiempo de actividad:", From 59682f684068b1f3a1d947b0bf0f338e12cddbed Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Wed, 6 Sep 2023 17:01:39 +0200 Subject: [PATCH 11/15] Update de_de.json Added translation variable "Systeminfo_System_Running_Processes" --- front/php/templates/language/de_de.json | 1 + 1 file changed, 1 insertion(+) diff --git a/front/php/templates/language/de_de.json b/front/php/templates/language/de_de.json index 8e2586af..6344535c 100755 --- a/front/php/templates/language/de_de.json +++ b/front/php/templates/language/de_de.json @@ -410,6 +410,7 @@ "Systeminfo_System_AVG": "AVG laden:", "Systeminfo_System_Kernel": "Kernel:", "Systeminfo_System_OSVersion": "Betriebssystem:", + "Systeminfo_System_Running_Processes" : "Laufende Prozesse", "Systeminfo_System_System": "System:", "Systeminfo_System_Uname": "Uname:", "Systeminfo_System_Uptime": "Betriebszeit:", From fdcf12fb861b6be4287ef248b5e63674abcb9d15 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Wed, 6 Sep 2023 17:02:57 +0200 Subject: [PATCH 12/15] Update systeminfo.php Changed translation variable "Systeminfo_Running_Processes" to "Systeminfo_System_Running_Processes" --- front/systeminfo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/systeminfo.php b/front/systeminfo.php index d664cdc9..b15d0956 100755 --- a/front/systeminfo.php +++ b/front/systeminfo.php @@ -216,7 +216,7 @@ echo '
'. $load_average[0] .' '. $load_average[1] .' '. $load_average[2] .'
-
' . lang('Systeminfo_Running_Processes') . '
+
' . lang('Systeminfo_System_Running_Processes') . '
' . $system_process_count . '
From 06a11f43ea25e242df57c68c7c6aa027195cb9d9 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Wed, 6 Sep 2023 17:06:25 +0200 Subject: [PATCH 13/15] Update es_es.json Updated translation variable "Systeminfo_System_Running_Processes" --- front/php/templates/language/es_es.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/php/templates/language/es_es.json b/front/php/templates/language/es_es.json index 4485f363..865bef0d 100755 --- a/front/php/templates/language/es_es.json +++ b/front/php/templates/language/es_es.json @@ -642,7 +642,7 @@ "Systeminfo_System_AVG": "Cargar promedio:", "Systeminfo_System_Kernel": "NĂșcleo:", "Systeminfo_System_OSVersion": "Sistema Operativo:", - "Systeminfo_System_Running_Processes" : "Procesos corriendo", + "Systeminfo_System_Running_Processes" : "Procesos corriendo:", "Systeminfo_System_System": "Sistema:", "Systeminfo_System_Uname": "Uname:", "Systeminfo_System_Uptime": "Tiempo de actividad:", From d444ad31cef1c1de4bdacc105f59bdb5ec2c82df Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Wed, 6 Sep 2023 17:06:39 +0200 Subject: [PATCH 14/15] Update en_us.json Updated translation variable "Systeminfo_System_Running_Processes" --- front/php/templates/language/en_us.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/php/templates/language/en_us.json b/front/php/templates/language/en_us.json index a8f00fda..e8b5bd2e 100755 --- a/front/php/templates/language/en_us.json +++ b/front/php/templates/language/en_us.json @@ -648,7 +648,7 @@ "Systeminfo_System_AVG": "Load average:", "Systeminfo_System_Kernel": "Kernel:", "Systeminfo_System_OSVersion": "Operating System:", - "Systeminfo_System_Running_Processes" : "Running processes", + "Systeminfo_System_Running_Processes" : "Running processes:", "Systeminfo_System_System": "System:", "Systeminfo_System_Uname": "Uname:", "Systeminfo_System_Uptime": "Uptime:", From e4a34ecd2bd5919855e4e4106964639d007058b4 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Wed, 6 Sep 2023 17:06:57 +0200 Subject: [PATCH 15/15] Update de_de.json Updated translation variable "Systeminfo_System_Running_Processes" --- front/php/templates/language/de_de.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/php/templates/language/de_de.json b/front/php/templates/language/de_de.json index 6344535c..4ce21f7f 100755 --- a/front/php/templates/language/de_de.json +++ b/front/php/templates/language/de_de.json @@ -410,7 +410,7 @@ "Systeminfo_System_AVG": "AVG laden:", "Systeminfo_System_Kernel": "Kernel:", "Systeminfo_System_OSVersion": "Betriebssystem:", - "Systeminfo_System_Running_Processes" : "Laufende Prozesse", + "Systeminfo_System_Running_Processes" : "Laufende Prozesse:", "Systeminfo_System_System": "System:", "Systeminfo_System_Uname": "Uname:", "Systeminfo_System_Uptime": "Betriebszeit:",