get($_SESSION['domain']['language']['code'], 'app/system'); //system cpu status echo "
\n"; //set the row style class names $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; //get the CPU details if (stristr(PHP_OS, 'BSD') || stristr(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; } } if (stristr(PHP_OS, 'BSD')) { $result = shell_exec("dmesg | grep -i --max-count 1 CPUs | sed 's/[^0-9]*//g'"); $cpu_cores = trim($result); } if (stristr(PHP_OS, 'Linux')) { $result = @trim(shell_exec("grep -P '^processor' /proc/cpuinfo")); $cpu_cores = count(explode("\n", $result)); } if ($cpu_cores > 1) { $percent_cpu = $percent_cpu / $cpu_cores; } $percent_cpu = round($percent_cpu, 2); //uptime $result = shell_exec('uptime'); $load_average = sys_getloadavg(); } //show the content echo "
\n"; echo " ".$text['label-cpu_usage']."\n"; //add half doughnut chart if (!isset($dashboard_chart_type) || $dashboard_chart_type == "doughnut") { ?>
".round($percent_cpu)."%"; } echo "
\n"; if ($dashboard_details_state != 'disabled') { echo "
"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; if (PHP_OS == 'FreeBSD' || PHP_OS == 'Linux') { if (!empty($percent_cpu)) { echo "\n"; echo "\n"; echo "\n"; echo "\n"; $c = ($c) ? 0 : 1; } if (!empty($cpu_cores)) { echo "\n"; echo "\n"; echo "\n"; echo "\n"; $c = ($c) ? 0 : 1; } echo "\n"; echo "\n"; echo "\n"; echo "\n"; $c = ($c) ? 0 : 1; echo "\n"; echo "\n"; echo "\n"; echo "\n"; $c = ($c) ? 0 : 1; echo "\n"; echo "\n"; echo "\n"; echo "\n"; $c = ($c) ? 0 : 1; } echo "
".$text['label-name']."".$text['label-value']."
\n"; echo "
"; //$n++; echo ""; } echo "
\n"; ?>