diff --git a/app/system/resources/dashboard/system_cpu_status.php b/app/system/resources/dashboard/system_cpu_status.php
index f4a07e86ca..84bd7e3844 100644
--- a/app/system/resources/dashboard/system_cpu_status.php
+++ b/app/system/resources/dashboard/system_cpu_status.php
@@ -16,94 +16,105 @@
//add multi-lingual support
$language = new text;
- $text = $language->get($_SESSION['domain']['language']['code'], 'core/user_settings');
+ $text = $language->get($_SESSION['domain']['language']['code'], 'app/system');
-//system status
+//system cpu status
echo "
\n";
+//set the row style class names
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
- //cpu usage
- if (stristr(PHP_OS, 'Linux')) {
+//get the CPU details
+ if (PHP_OS == 'FreeBSD' || PHP_OS == 'Linux') {
+
$result = shell_exec('ps -A -o pcpu');
$percent_cpu = 0;
foreach (explode("\n", $result) as $value) {
if (is_numeric($value)) { $percent_cpu = $percent_cpu + $value; }
}
- $result = trim(shell_exec("grep -P '^processor' /proc/cpuinfo"));
- $cores = count(explode("\n", $result));
- if ($percent_cpu > 1) { $percent_cpu = $percent_cpu / $cores; }
+ if (stristr(PHP_OS, 'Linux')) {
+ $result = trim(shell_exec("grep -P '^processor' /proc/cpuinfo"));
+ $cpu_cores = count(explode("\n", $result));
+ }
+ if ($percent_cpu > 1) { $percent_cpu = $percent_cpu / $cpu_cores; }
$percent_cpu = round($percent_cpu, 2);
+
+ //uptime
+ $result = shell_exec('uptime');
+ $load_average = sys_getloadavg();
+
}
+//add half doughnut chart
+ ?>
+
- //add half doughnut chart
- ?>
-
-
-
- '
+ }
+ }
+ },
+ plugins: [chart_counter_2],
+ };
+
+ const system_cpu_status_chart = new Chart(
+ system_cpu_status_chart_context,
+ system_cpu_status_chart_config
+ );
+
+
+";
echo "
\n";
echo "\n";
@@ -111,21 +122,47 @@
echo "| ".$text['label-value']." | \n";
echo "
\n";
- //cpu usage
- if (stristr(PHP_OS, 'Linux')) {
- if ($percent_cpu != '') {
- echo "\n";
- echo "| ".$text['label-processor_usage']." | \n";
- echo "".$percent_cpu."% | \n";
- echo "
\n";
- $c = ($c) ? 0 : 1;
- }
+ if (PHP_OS == 'FreeBSD' || PHP_OS == 'Linux') {
+ if ($percent_cpu != '') {
+ echo "\n";
+ echo "| ".$text['label-cpu_usage']." | \n";
+ echo "".$percent_cpu."% | \n";
+ echo "
\n";
+ $c = ($c) ? 0 : 1;
}
+ if ($cpu_cores != '') {
+ echo "\n";
+ echo "| ".$text['label-cpu_cores']." | \n";
+ echo "".$cpu_cores." | \n";
+ echo "
\n";
+ $c = ($c) ? 0 : 1;
+ }
+
+ echo "\n";
+ echo "| ".$text['label-load_average']." (1) | \n";
+ echo "".$load_average[0]." | \n";
+ echo "
\n";
+ $c = ($c) ? 0 : 1;
+
+ echo "\n";
+ echo "| ".$text['label-load_average']." (5) | \n";
+ echo "".$load_average[1]." | \n";
+ echo "
\n";
+ $c = ($c) ? 0 : 1;
+
+ echo "\n";
+ echo "| ".$text['label-load_average']." (15) | \n";
+ echo "".$load_average[2]." | \n";
+ echo "
\n";
+ $c = ($c) ? 0 : 1;
+ }
+
echo "
\n";
echo "
";
$n++;
echo "