mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Update user_dashboard.php
Fix the CPU usage on the dashboard.
This commit is contained in:
@@ -1049,10 +1049,15 @@
|
||||
|
||||
//cpu usage
|
||||
if (stristr(PHP_OS, 'Linux')) {
|
||||
$ps = shell_exec("/usr/bin/which top");
|
||||
$sed = shell_exec("/usr/bin/which sed");
|
||||
$awk = shell_exec("/usr/bin/which awk");
|
||||
$percent_cpu = shell_exec($top." -bn1 | grep 'Cpu(s)' | ".$sed." 's/.*, *\([0-9.]*\)%* id.*/\1/' | ".$awk." '{print 100 - $1}' ");
|
||||
$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; }
|
||||
$percent_cpu = round($percent_cpu, 2);
|
||||
if ($percent_cpu != '') {
|
||||
$hud[$n]['html'] .= "<tr class='tr_link_void'>\n";
|
||||
$hud[$n]['html'] .= "<td valign='top' class='".$row_style[$c]." hud_text'>".$text['label-processor_usage']."</td>\n";
|
||||
|
||||
Reference in New Issue
Block a user