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 = system("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();
}
//add half doughnut chart
?>
";
echo "
\n";
echo "\n";
echo "| ".$text['label-name']." | \n";
echo "".$text['label-value']." | \n";
echo "
\n";
if (PHP_OS == 'FreeBSD' || PHP_OS == 'Linux') {
if (!empty($percent_cpu)) {
echo "\n";
echo "| ".$text['label-cpu_usage']." | \n";
echo "".$percent_cpu."% | \n";
echo "
\n";
$c = ($c) ? 0 : 1;
}
if (!empty($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 "